Manual destroy of Photon View

Options
Hi,

I'm Andrea, from 3GoGames. We are working on an arcade game. At the end of the game, we want to allow players to vote for rematch. When they do that, the scene is re-loaded and the flow starts again.

But when I load the new scene i get some warning:
"Received OnSerialization for view ID ###. We have no such PhotonView!"

on each client.

I tried to call UnallocateViewID() on mine photon view before reload scene.
Should I call UnallocateViewID() on non-mine photon views?

Now, before leave the scene I call, foreach object:

if ( obj != null ) { PhotonView

Comments

  • erre
    Options
    Hi,

    I'm Andrea, from 3GoGames. We are working on an arcade game. At the end of the game, we want to allow players to vote for rematch. When they do that, the scene is re-loaded and the flow starts again.

    But when I load the new scene i get some warning:
    "Received OnSerialization for view ID ###. We have no such PhotonView!"

    on each client.

    I tried to call UnallocateViewID() on mine photon view before reload scene.
    Should I call UnallocateViewID() on non-mine photon views?

    Now, before leave the scene I call, foreach object:

    if ( obj != null ) { bool isMine = false; int viewID = 0; PhotonView pv = obj.GetComponent<PhotonView>(); if ( pv != null ) { isMine = pv.isMine; viewID = pv.viewID; } GameObject.Destroy ( obj ); if (isMine) { PhotonNetwork.UnallocateViewID ( viewID ) ; } }

    What's wrong with this?

    Thank you very much.
    Andrea.
  • Tobias
    Options
    Are you using PhotonNetwork.Instantiate()? If so, you should also use PhotonNetwork.Destroy(obj), so the networked object gets destroyed on server and all remote clients. There are a few variants of methods to remove (your) networked game objects. Check out the PhotonNetwork class for those.

    I guess PUN's feature to sync the scene doesn't cover the case of re-loading the same one. But a clean-up pass should be simple.