我已经花了好几天时间来解决这个问题,在网上浏览了许多资料,但没有任何帮助我解决它的方法:我正在使用 Visual Studio 2012 创建一个 MonoGame 应用程序,但是在尝试加载纹理时,遇到了以下问题:
无法加载 Menu/btnPlay 资源!
我设置了内容目录:Content.RootDirectory = "Assets"; 并且将 btnPlay.png 文件的属性设置为:生成操作(Build Action):Content 和 复制到输出目录(Copy to Output directory):如果较新则复制。
我的构造函数和 LoadContent 函数完全为空,但请自行查看:
public WizardGame()
{
Window.Title = "Just another Wizard game";
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Assets";
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
_spriteBatch = new SpriteBatch(GraphicsDevice);
Texture2D texture = Content.Load<Texture2D>("Menu/btnPlay");
_graphics.IsFullScreen = true;
_graphics.ApplyChanges();
}
我很高兴能提供帮助!关于这个问题,我感到非常绝望......