c# - 错误 - SpriteFont 未实现

标签 c# monogame spritefont

我正在尝试在 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 构建操作设置为“内容”,并将“复制到输出目录”设置为“始终复制”。 SpriteFont1.xnb 文件位于 Content 文件夹中,具有相同的设置。如何修复错误以便加载 SpriteFont?

最佳答案

简单修复。根据堆栈跟踪(感谢 Richard Schneider),我发现 SpriteFont1.xnb 文件需要与实际的 .SpriteFont 文件位于同一文件夹中。

关于c# - 错误 - SpriteFont 未实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28160614/

相关文章:

c# - 如何通过按删除按钮从 ListView 中删除选定的项目?

xamarin - 有 F# Monogame 模板吗?

c# - 如何实现自动换行?

c# - 如何在 asp.net web api 中启用 cors 选项。?

c# - 将变量转换为仅在运行时已知的类型?

c# - 在列表中查找重复但符合条件

.net - MonoGame 游戏是否能够在未安装的情况下运行?

c# - 如何重启 XNA 游戏类(Monogame)

c# - 如何在 XNA 中绘制特殊字符?