Quantcast
Viewing all articles
Browse latest Browse all 6821

How to prevent PNG from being converted to PNG.XNB ?

@quidam_ibidem wrote:

I am a beginner, and I use monogamous recently. I would like to display an image on the screen, simply.
How I'm trying to do it:
Texture2D image;
string path;
public override void LoadContent()
{
base.LoadContent();
path = "C:\\Users\\Quidam\\source\\repos\\LearningGameDev\\LearningGameDev\\Content\\SplashScreen\\Image1.png";
image = content.Load<Texture2D>(path);
}

I have put my image inside the project like this:
Image may be NSFW.
Clik here to view.

And when I run the code I get this error:

Microsoft.Xna.Framework.Content.ContentLoadException: 'The content file was not found.'
Microsoft.Xna.Framework.Content.ContentLoadException
HResult=0x80131500
Message=The content file was not found.
Source=MonoGame.Framework
StackTrace:
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
at LearningGameDev.SplashScreen.LoadContent() in C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\SplashScreen.cs:line 20
at LearningGameDev.ScreenManager.LoadContent(ContentManager Content) in C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\ScreenManager.cs:line 40
at LearningGameDev.Game1.LoadContent() in C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\Game1.cs:line 45
at Microsoft.Xna.Framework.Game.Initialize()
at LearningGameDev.Game1.Initialize() in C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\Game1.cs:line 33
at Microsoft.Xna.Framework.Game.DoInitialize()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at LearningGameDev.Program.Main() in C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\Program.cs:line 17

Inner Exception 1:
FileNotFoundException: Could not find file 'C:\Users\Quidam\source\repos\LearningGameDev\LearningGameDev\Content\SplashScreen\Image1.png.xnb'.

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles