Advertisement
LeeMace

Singleton Instantiation

Mar 7th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.27 KB | Gaming | 0 0
  1.  //Singleton instansiation
  2.     private static NewPlayer instance;
  3.     public static NewPlayer Instance
  4.     {
  5.         get
  6.         {
  7.             if (instance == null) instance = GameObject.FindObjectOfType<NewPlayer>();
  8.             return instance;
  9.         }
  10.     }
Tags: singleton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement