我试着在一个Monogame程序中画文本。我想使用一个SpriteFont来完成这个任务,但是当我试图加载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.SpriteFont1构建操作设置为"Content“,将复制设置为”始终复制“。SpriteFent1.xnb文件位于Content文件夹中,具有相同的设置。如何修正错误,以便加载SpriteFont?
发布于 2015-01-26 23:39:00
简单的解决办法。在堆栈跟踪之后(感谢Richard ),我发现SpriteFent1.xnb文件需要与实际的.SpriteFont文件位于同一个文件夹中。
发布于 2016-09-26 17:28:08
实际上,只需要.xnb文件,因为它是从.SpriteFont编译的,所以您应该只将.xnb文件复制到Content文件夹。
NotImplementedException是因为没有实现LoadContent来直接加载.SpriteFont文件。(用MonoGame 3.5测试)
https://stackoverflow.com/questions/28160614
复制相似问题