Having a PhotonView ID duplicate found error when using JoinRoom or JoinRandomRoom
Options
So here's the line of error I'm having:
The problem happens whenever I join a room using:
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:
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?
"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?
0
Comments
-
Hi @water,
if you are allocating view IDs manually you have to unallocate them as well. You can do this by usingPhotonNetwork.UnAllocateViewID(int viewID);
for example inside the OnDestroy function from a certain object.
Do you use buffered messages for the Manual Instantiation?0 -
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 tryPhotonNetwork.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 thatPhotonNetwork.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);
0 -
Is there any chance for sharing a repro case so that I can take a look at it directly?0
-
Alright I'll see what I can do to cut that piece so I can send it here.1