Major instantiation and destruction problems

Using the latest PUN when you PhotonNetwork.Instantiate a GameObject and PhotonNetwork.Destroy it the remote does not get destroyed properly.

For example, if I instantiate a player avatar and destroy the avatar (he gets killed) most of the time the GameObject gets removed on both the local and remote client but sometimes the remote does not get removed. In cases where the remote does get removed it seems as though the PhotonViews are not being handled properly because when you instantiate a new avatar for that player after being destroyed once a new avatar never gets instantiated on the remote again. When you execute RPC calls on the local avatar the remote client still receives them (and throws errors) because the remote avatar does not exist to receive them.

Further testing shows even more strange behaviour: when I instantiate cubes until there are 10 and then destroy them all and keep repeating that cycle the first 10 cubes never get destroyed on the remote.

This bug has stopped our project in its tracks so I would really appreciate any advice about how to solve or work around this problem.

Comments

  • PhotonNetwork.Destroy() should only be called on your own objects (your own photonviews etc.), unless you are the masterclient; the masterclient can affect all photonviews. Maybe this is part of the problem? However it could be that we are not properly checking if PhotonNetwork.Destroy is only called on owned objects.
    Further testing shows even more strange behaviour: when I instantiate cubes until there are 10 and then destroy them all and keep repeating that cycle the first 10 cubes never get destroyed on the remote.
    This bug has stopped our project in its tracks so I would really appreciate any advice about how to solve or work around this problem.

    Would you be able to share this repro case? With a clear repro case we can fix the bug instantly.
  • Using the latest loadbalancing server and PUN on one client try repeatedly creating an array of objects with PhotonNetwork.Instantiate and destroying that array with PhotonNetwork.Destroy and watch the remote to see if it has the same composition of objects as the client.
  • I believe this has been fixed in 1.8. The problem occured when using destroy, and then in that same frame another Instantiate.
    I hope we push 1.8 to the asset store today.
  • Just uploaded 1.8 and it should be a matter of hours until it's live.