Synchronizing Photon View ID

Options
Hello. We are developing a project for different platforms: VR and mobile app, they work together, but we have a problem: The Unity build has a different photon view id's then was in the unity editor. So in the build we get an exception in the log file like "PhotonView with ID 2 has no method "RPCGetState" marked with the [PunRPC]..."
Thus our cross-platform project works incorrectly. Whats the best solution to sync photon view ids between different platforms?

Comments

  • Hi @JerryLetehen,

    if you use PhotonNetwork.Instantiate for Instantiation, the ViewId should be automatically synchronized on all clients. If you use Manual Instantiation, you would have to allocate a ViewId on one client and share this information with other clients in the room. The link in the last sentence has an example how you would do that.

    In terms of the console log: please check, if the certain method is tagged with the [PunRPC] attribute. If it is tagged but still doesn't work, you can take a look at the PhotonServerSettings file and click on the Refresh RPCs button to check if this helps.
  • Hi @Christian_Simon, thank for your answer. We do not use PhotonNetwork.Instantiate for instantiating managers, they already exist in scenes. So our scenes have same view ids in our managers, but after build viewId is shuffling sometimes.
  • In this case I would recommend to remove the PhotonView component from the managers and use the RaiseEvent function instead of RPCs. RaiseEvent has the benefit, that you don't need an attached PhotonView component, so you won't have problems with incorrect ViewIDs. To see how to use RaiseEvent, you can take a look at the RPCs and RaiseEvent documentation page.
  • JerryLetehen
    edited December 2018
    Options
    @Christian_Simon, does the Custom room and player properties work without PhotonView?
  • Yes, these are two (or three) completely different things. All of them work independent from each other.
  • @Christian_Simon, thanks you very much.