• Advertisement
Sign in to follow this  

Texture Disposal Error

This topic is 4347 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to dispose my block texture for the tetris game, it gives me an error: "Object reference not set to an instance of an object" pointing to the line block.Dispose(); I have another texture that is used in the same way, and it doesn't give me that error. What could cause this to happen? I know it's an instance of the Texture object, because I used it.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Grantyt3
When I try to dispose my block texture for the tetris game, it gives me an error: "Object reference not set to an instance of an object" pointing to the line block.Dispose(); I have another texture that is used in the same way, and it doesn't give me that error. What could cause this to happen? I know it's an instance of the Texture object, because I used it.

I'm not a managed expert, but it sounds like you have already disposed it when you try to do this. The easiest way to find out what's wrong: fire up the debugger, navigate to this code, and watch your block object. You should be able to see if it is indeed still a texture object, or if you have already disposed it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement