duplicate viewID issue on scene load

Options
Hi,

Just started to use the PUN for my project. Everything looks great! Thanks.
Just 1 thing I can't understand currently. Here is editor runtime error:
PhotonView ID duplicate found: 1. New: View (0)1 on GameManager_Network (scene) old: View (0)1 on NetworkManager (scene). Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new.

How I understand that is because of same ViewID (value = 1) on objects at 2 different scenes. My structure looks like that:
1 scene - containing NetworkManager object with PhotonView component viewID = 1
2 scene - containing GameManager_Networkobject with PhotonView component viewID = 1

I can change view ID in prefab instance in the scene, but if I click Apply, that resets to 1 again.

How can I avoid that?

Comments

  • novavision
    Options
    P.S. that viewID value resets to 1 also after scene loading. that makes really uncomfortable usage to change it all the time
  • vadim
    Options
    Hi,

    Did you check for DontDestroyOnLoad as error message says? Is object from unloaded scene kept intentionally? If yes, don't use PhotonView on such object.
  • carcer
    Options
    I have the same issue. One scene, the loading scene has the game manager which has/needs a photonview in it. Its set to scene, fixed, and saves to view id 1. There are prefabs in the actual game scene which are scene objects, set to 'takeover'. But they default to view id 1 as well. Don't destroy on load, whether is ticked or not ticked, makes no difference.
    I don't want to spawn in all my prefabs some of them I want to have already placed in the scene.
  • Tobias
    Options
    The viewIDs are assigned per scene and might clash when objects are not destroyed on load.

    There are scene settings in which you can define the "start viewID" per scene to avoid clashes of viewIDs.
    Find this file in your project and edit it to unique start IDs:
    \Assets\Photon Unity Networking\Editor\PhotonNetwork\PunSceneSettingsFile

    Hope that helps.
  • carcer
    Options
    thanks for that!