Reputation: 721
I am making a program for a school project and I am new to XNA Game Studio. For some reason even though the file is in Content. I am getting a ContentLoadException occured in Microsoft.Xna.Framework.dll on the code,
spriteSheet = Content.Load<Texture2D>("mario-2");
The code is in the Scene class I created in the initScene function, and the initScene is called after SpriteBatch is created in the LoadContent function on the generated default Game1 class.
I checked the properties of mario-2.png, and the asset name matches the one used and the Content Importer and Content Processer are set to Texture - XNA FrameWork.
Content's RootDirectory was set to "Content" when Game1 was constructed.
Upvotes: 0
Views: 517
Reputation: 198
Check these two things:
1.) Is the image compiled into xnb and in the content folder? I'm not certain that placing the uncompiled image in there will work.
2.) Check the asset name in the properties window of the xnb file to ensure it matches the string you specified in your content.load method.
Upvotes: 0