public static void Destroy(this Photon.PunBehaviour obj, bool deactive = true) { if (PhotonNetwork.inRoom) { if (obj.photonView.isMine) { PhotonNetwork.Destroy(obj.photonView); } } else { if (deactive) { obj.gameObject.SetActive(false); } else { GameObject.Destroy(obj.gameObject); } } }
public static bool isMine(Photon.PunBehaviour script) { return(!PhotonNetwork.inRoom || script.photonView.isMine); }