Modding Help NullReferenceException when trying to call in-game font's method

Discussion in 'Mods' started by Hakej, Feb 3, 2020.

Tags:
  1. Hakej

    Hakej Space Hobo

    Hi.
    So I'm trying to draw UI with my mod, and one of the things I have to do is measure the size of the text inside depending on the font used. However, I get NullReferenceException whenever I try to do anything with the in-game font.
    Code:
    var size = Game1.dialogueFont.MeasureString(str)
    This is where I get the exception, which is weird, cause I swear to God it was working. What am I missing? I'm stuck with this for a long time already and I have no idea why is this the case.
     

    Share This Page