【问题标题】:Visual Studio 2015 MonoGame: Cannot find Texture2DReaderVisual Studio 2015 MonoGame:找不到 Texture2DReader
【发布时间】:2015-09-30 06:02:58
【问题描述】:

这行代码

backgroundImage = Content.Load<Texture2D>("Backgrounds/titleScreen");

导致此错误

An unhandled exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll

Additional information: Error loading "Backgrounds\titleScreen". Cannot find ContentTypeReader Microsoft.Xna.Framework.Content.Texture2DReader.

在我尝试将其从 Visual Studio 2010 转换为 2015 之前,此代码运行良好。在我的 Content 文件夹中是一个 Backgrounds 文件夹,其中包含 titleScreen.png,所以我知道路径是正确的。

【问题讨论】:

  • 也许尝试重新安装 MonoGame。

标签: c# visual-studio-2010 xna visual-studio-2015 monogame


【解决方案1】:

请尝试使用 bin\content 文件夹中的 .xnb 文件。 还要仔细检查纹理的路径和文件的名称(我的意思是区分大小写)。 我也在xna Visual Studio中部署时,它工作正常..在monogame中部署时,它抛出错误,我正在尝试将文件名作为屏幕,其中文件名是屏幕。 最安全的是尝试使用 XNB 文件。

【讨论】:

  • 尝试使用 .xnb 文件是什么意思?您的意思是尝试从 xnb 文件而不是 png 文件加载纹理?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-13
  • 1970-01-01
相关资源
最近更新 更多