halfmagic
3/4/2020 - 1:18 AM

Unity singletone script

#region make singletone

  public static Singletone Instance { get; private set; }
  void Awake()
  {
    if (Instance == null)
      Instance = this;
    else if (Instance != this)
      Destroy(gameObject);

    DontDestroyOnLoad(this.gameObject);
  }
  #endregion
singletoneScript = Singletone.Instance;