Changing NetworkView viewIDs


We are having an issue in our application, which after some investigation seems to be caused by the need to change viewIDs during manual instantiation (e.g. see manual instantiation example in photon docs).

The problem seems to stem from the fact that if the viewID of a NetworkView that has already been registered changes, then PhotonNetwork.networkingPeer.photonViewList Dictionary becomes inconsistent. Specifically the dictionary key (which is normally equivalent to the viewID), keeps the old viewID value, while the viewID in the referenced NetworkView is changed to the new one. This is a problem because some part of the Photon code test for the presence of a view in this list by testing the viewID in the referenced NetworkView (e.g. NetworkingPeer.RegisterPhotonView), while other parts of the code test for presence of a view by simply testing for the existence of a matching dictionary key (e.g. PhotonNetowork.AllocateViewId).

The fact that there are issues here are acknowledged in the comments in the set code of the viewID property in NetworkView (and the commented out code suggests that this case is not being handled properly at the moment):

// TODO: decide if a viewID can be changed once it wasn't 0. most likely that is not a good idea
// check if this view is in networkingPeer.photonViewList and UPDATE said list (so we don't keep the old viewID with a reference to this object)
// PhotonNetwork.networkingPeer.RemovePhotonView(this, true);

Please could someone from Exit Games comment on the situation, when it is likely to be resolved, and possible workarounds etc.?

Thank you,

Sign In or Register to comment.