Search code examples
c#monogamespritefont

Error - SpriteFont not implemented


I'm trying to draw text in a Monogame program. I want to use a SpriteFont to do it, but I get the following error when trying to load the SpriteFont.

//Here I try to load the SpriteFont
//It is kept in the "Content/fonts" folder, with "Content" as the Content.RootDirectory
Font = Content.Load<SpriteFont>("fonts/SpriteFont1");

//I then get this error
An unhandled exception of type 'System.NotImplementedException' occurred in MonoGame.Framework.dll
Additional information: The method or operation is not implemented.

The SpriteFont1 build action is set to "Content" with Copy To Output Directory as "Copy Always". The SpriteFont1.xnb file is in the Content folder, with the same settings. How can I fix the error so that I can load the SpriteFont?


Solution

  • Simple fix. Following the stack trace (thanks to Richard Schneider), I found that the SpriteFont1.xnb file needed to be in the same folder as the actual .SpriteFont file.