title: Best way to implement Unity Singleton?
body: <p>I'm a beginner to Unity.</p>
  
  <p>I'm currently implementing Singleton.</p>
  
  <p>I have questions while studying.</p>
  
  <p>What is the best way to implement Singleton in Unity like the title?</p>
  
  <p>I understand why use a singleton. that is..
  " To create an object once and use it whenever need it. " </p>
  
  <p>Do I understand it properly?</p>
  
  <p>There are many ways to implement singletons. It's right?
  Then, Which part of the many methods are used in common?</p>
  
  <p>My singleton code is:</p>
  
  <pre><code>public class GameSingleton&lt;T&gt; : MonoBehaviour where T : MonoBehaviour
  {
      protected static T instance = null;
  
      protected virtual void Awake()
      {
          Debug.Log ("instance was !!!!! &gt;&gt;" + instance);
  
          if(instance != null) // 최초 instance 유효성 검사
          {
              Debug.Log("&gt;&gt; Game Singleton already exist!");
              return;
          }
  
          instance = FindObjectOfType&lt;T&gt;(); // 
          Debug.Log("FindObj" + "/" + "instance is &gt;&gt; " + instance);
      }
  
      // Use this for initialization
      protected virtual void Start()
      {
  
      }
  
      // Update is called once per frame
      protected virtual void Update()
      {
  
      }
  
      protected virtual void OnDestroy()
      {
          if (instance != null)
          {
              instance = null;
          }
      } 
  
      public static T Instance
      {
          get
          {
              if(instance == null)
              {
                  GameObject go = new GameObject();
                  go.transform.position = Vector3.zero; // Vector3(0,0,0)
                  go.transform.rotation = Quaternion.identity; // 회전 없음
                  go.transform.localScale = Vector3.one;
                  go.hideFlags = HideFlags.HideAndDontSave;
                  instance = go.AddComponent&lt;T&gt;();
                  instance.name = (typeof(T)).ToString();
                  Debug.Log("&gt;&gt; Game Singleton instance create : " + instance);
              }
              return instance;
          }
      }
  }
  </code></pre>
  
  <p>We'd appreciate it if you could review the code, 
  but we'd also appreciate a few key points.</p>
  
  <p>I have seen several documents, but they only get complicated.
  My level is very low. I would appreciate it if you could explain it easily.</p>