Beginner C# image loading woes - NullReferenceException

Posted by Seth Taddiken on Game Development See other posts from Game Development or by Seth Taddiken
Published on 2012-10-29T03:15:10Z Indexed on 2012/10/29 11:19 UTC
Read the original article Hit count: 233

Filed under:
|

I keep getting a "NullReferenceExeption was unhandled" with "Object reference not set to an instance of an object." written under it. I have all of the images (png) correct with names and added to references.

protected override void LoadContent()
{
    spriteBatch = new SpriteBatch(GraphicsDevice);
    backGround = Content.Load<Texture2D>("Cracked");
    player1.playerBlock = Content.Load<Texture2D>("square");
    player2.playerBlock = Content.Load<Texture2D>("square2");
}

© Game Development or respective owner

Related posts about c#

Related posts about 2d