Question by
LifeOfRylo · Aug 18, 2016 at 07:19 PM ·
unity 5objectobjectsstaticstatic variable
How do I reset a static gameObject?
Whenever I exit the game to start a new game, it crashes. The problem is that I have two static game objects in my code, because they are used in more than one class. Is there any way to fix this without having to change a substantial amount of code.
Comment
Answer by Jessespike · Aug 18, 2016 at 09:04 PM
Probably, I mean you didn't really explain the crash very well, so I can only guess. Have you tried creating a condition that simply checks if the GameObject exists?
if (myGameObject != null)
{
//do stuff
}