我刚刚开始使用MonoGame,每当我运行我的程序时,我都会收到无法将资产加载为非内容文件错误的情况。我一直在寻找网络,并没有发现任何关于我的问题。请帮忙!Monogame:无法将资产加载为非内容文件
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace MoveDemo
{
public class MainGame : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D mainmenu;
public MainGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
mainmenu = Content.Load<Texture2D>("MainMenu");
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
spriteBatch.Begin();
spriteBatch.Draw(mainmenu, new Rectangle(0, 0, 840, 480), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
}
}
我假设你已经通过内容管道工具添加了文件,并且它构建? – Olivier