Trouble sending Destroy() through a method by RPC

I have a method called explode that does various things if the gameobject that is calling it is the same thing as the gameobject in the parameter. One of those things is to PhotonNetwork.Destroy(it). The RPC call is photonView.RPC("explode",PhotonTargets.All,co.gameObject);
When I try it I get two debug messages:
Illegal view ID:0 method: explode GO:Missile(Clone)
UnityEngine.Debug:LogError(Object)
Exception: cannot serialize(): UnityEngine.GameObject
ExitGames.Client.Photon.Protocol.Serialize (System.IO.MemoryStream dout, System.Object serObject, Boolean setType)

Comments

  • Destroy will sync the destruction of a Game Object.
    If the owner destroys a GO while some remote player sends the RPC at the same time, then it's up the the individual user's lag if the destroy is first or the RPC. If the RPC is late, it won't find the GO anymore.

    You can't serialize a GameObject and send it. But you don't need it either:
    Calling an RPC on a PhotonView will call the RPC on the specific GO of the remote player. You don't need to identify it yourself.