Having a PhotonView ID duplicate found error when using JoinRoom or JoinRandomRoom

Options
So here's the line of error I'm having:
"PhotonView ID duplicate found: 1001. New: View (0)1001 on FPSController old: View (0)1001 on FPSController . Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new."

The problem happens whenever I join a room using: PhotonNetwork.JoinRoom(roomName); or PhotonNetwork.JoinRandomRoom();

I use Manual Instantiation approach as indicated by a sample code in:
https://doc.photonengine.com/en-us/pun/current/gameplay/instantiation

I do control the scene loading though, but the thing is I don't have an FPSController that's tagged "DontDestroyOnLoad()", those things are cleaned whenever the scene is unloaded.

------

And then here comes a confusing part, if I use: PhotonNetwork.JoinOrCreateRoom(roomName);
things works as intended, and I don't get a duplicate PhotonView Id error. I can switch back on forth on my scenes with my players and it just works smoothly.

Anyone have any clue as to why JoinRoom() and JoinRandomRoom() is throwing such errors?

Comments

  • [Deleted User]
    Options
    Hi @water,

    if you are allocating view IDs manually you have to unallocate them as well. You can do this by using PhotonNetwork.UnAllocateViewID(int viewID); for example inside the OnDestroy function from a certain object.

    Do you use buffered messages for the Manual Instantiation?
  • water
    Options
    Hello @Christian_Simon ,

    The problem is that this happens on the first creation of the room where everyone is getting in the first time and none was leaving the room yet. I'll try PhotonNetwork.UnAllocateViewId(int viewId); on the destroy function. I actually forgot to do that. Although I think it's not the problem at all since as I've said it happens when everyone is still getting in the room for the first time. It baffles me too that PhotonNetwork.JoinOrCreateRoom() works but not the 2 Join functions.

    Yes I used buffered messages for the Manual Instantiation:
    view.RPC("RPC_InstantiateOnNetwork", PhotonTargets.AllBuffered, prefab.name, position, rotation, id);
  • [Deleted User]
    Options
    Is there any chance for sharing a repro case so that I can take a look at it directly?
  • water
    Options
    Alright I'll see what I can do to cut that piece so I can send it here.