Skip to main content
gamedev.net
🔒 Locked

Texture Disposal Error

Started by Grantyt3 0 replies 300+ views
Original Post
Grantyt3
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.
circlesoft
circlesoft
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.