无法将资产加载为非内容
Could not load asset as non content
我正在尝试加载 png 文件作为测试 2d 纹理。我收到错误
"Could not load testTexture asset as a non-content file!".
我正在通过 Pipline.MacOS 应用程序加载 png。我已经设置了平台 MacOS 并重建了它。构建后将其放入默认的 Content 文件夹中。在代码中,我将根目录设置为内容文件夹,然后添加 2d 纹理。当我 运行 时,我得到错误
"Microsoft.Xna.Framework.Content.ContentLoadException" - Could not
load testTexture asset as a non-content file!
我已经检查了所有常见的事情,比如目标平台是否正确(这是针对 MacOS 的)。我不确定还有什么要尝试检查的。我正在使用带有单声道的 xamarin studio,而不是 xamarin.mac(单声道可以免费构建)。任何帮助都会非常感谢。
public Game1 ()
{
graphics = new GraphicsDeviceManager (this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;
}
protected override void LoadContent ()
{
spriteBatch = new SpriteBatch (GraphicsDevice);
texture = this.Content.Load<Texture2D> ("testTexture");
}
看来问题出在 xamarin studio 上。通过管道准备纹理后,xamarin 似乎还没有修复其自动将新内容与 Content.mgcb subfile/folder 链接的错误。要么那样,要么我不知何故做错了什么。无论哪种方式,您似乎都必须手动将文件添加到 ide 中的文件夹中。 (仅供参考,如果您使用 Visual Studio,这似乎不是问题)。
我正在尝试加载 png 文件作为测试 2d 纹理。我收到错误
"Could not load testTexture asset as a non-content file!".
我正在通过 Pipline.MacOS 应用程序加载 png。我已经设置了平台 MacOS 并重建了它。构建后将其放入默认的 Content 文件夹中。在代码中,我将根目录设置为内容文件夹,然后添加 2d 纹理。当我 运行 时,我得到错误
"Microsoft.Xna.Framework.Content.ContentLoadException" - Could not load testTexture asset as a non-content file!
我已经检查了所有常见的事情,比如目标平台是否正确(这是针对 MacOS 的)。我不确定还有什么要尝试检查的。我正在使用带有单声道的 xamarin studio,而不是 xamarin.mac(单声道可以免费构建)。任何帮助都会非常感谢。
public Game1 ()
{
graphics = new GraphicsDeviceManager (this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;
}
protected override void LoadContent ()
{
spriteBatch = new SpriteBatch (GraphicsDevice);
texture = this.Content.Load<Texture2D> ("testTexture");
}
看来问题出在 xamarin studio 上。通过管道准备纹理后,xamarin 似乎还没有修复其自动将新内容与 Content.mgcb subfile/folder 链接的错误。要么那样,要么我不知何故做错了什么。无论哪种方式,您似乎都必须手动将文件添加到 ide 中的文件夹中。 (仅供参考,如果您使用 Visual Studio,这似乎不是问题)。