private void OnDestroy() { if (!photonView.IsMine) { return; } // Destroy singleton reference if (LocalPlayer == this) { LocalPlayer = null; } }
private void Awake() { // Parameters initialization RespawnInitialization(); _animator = GetComponent <Animator>(); if (!photonView.IsMine) { Destroy(virtualCamera.GetComponent <CinemachineVirtualCamera>()); return; } // Singleton if (LocalPlayer != null) { Destroy(gameObject); } else { LocalPlayer = this; } }