public static void Destroy(GameObject go)
{
PhotonView view = go.GetComponent<PhotonView>();
if (view == null)
{
Debug.LogError("Cannot call Destroy(GameObject go); on the gameobject \"" + go.name + "\" as it has no PhotonView attached.");
}
else if (view.isMine)
{
int ID = networkingPeer.GetInstantiatedObjectsId(go);
if (ID <= 0)
{
Debug.LogError("Use PhotonNetwork.Destroy() only on GameObjects created with PhotonNetwork.Instantiate(). GameObject not destroyed: " + go);
}
else
{
networkingPeer.RemoveInstantiatedGO(go, false); //Success
}
}
else
{
Debug.LogError("Cannot call Destroy(GameObject go); on the gameobject \"" + go.name + "\" as we don't control it (Owner: " + view.owner + ").");
}
}