【发布时间】:2019-02-05 22:59:14
【问题描述】:
我几天前开始使用 monogame 编写 c#。 今天我收到一条错误消息,提示“无法将资产加载为非内容文件”。 这是代码,我需要很多帮助。 列出纹理;
public Game1()
: base()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
// the below line errors
textures.Add(Content.Load<Texture2D>("Lol"));
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
}
【问题讨论】: