private void OnDestroy() { if (Instance == this) { Instance = null; } }
private void Awake() { if (Instance == null) { Debug.Assert(Instance == null); Instance = this; DontDestroyOnLoad(this.gameObject); } else { Debug.Log("PingChecker is already exist, remove self"); GameObject.Destroy(this.gameObject); } }