How can i get gameobject in OnPhotonPlayerDisconnected

Options
Hey there,

I'm creating gameobjects with "PhotonNetwork.Instantiate" that game objects contain PhotonView component and a Sync script which is derived from "Photon.MonoBehaviour".

Whenever a client disconnected from server other clients receive "OnPhotonPlayerDisconnected(PhotonPlayer player)" event successfully, and then that game object going to destroyed by Photon, so my question is how can i properly get that Sync script in "OnPhotonPlayerDisconnected" event, or is there any other event for this usage ?

PS! I can set "photonView.owner.TagObject = this" in Sync script then i'm able to get player.TagObject in "OnPhotonPlayerDisconnected" but it looks so silly ...

Comments

  • vadim
    Options
    Every object with PhotonView in scene receives OnPhotonPlayerDisconnected. So just implement it in script.
    But I'm afraid that the object is destroyed already. It's not clear why you need to run something on disconnected player object.