how to make a singleton in unity

52

how to make a singleton in unity -

 void Awake()
 {
   if (instance == null)
     instance = this;
   else if (instance != this)
     Destroy(gameObject);
 }

Comments

Submit
0 Comments