The question is answered, right answer was accepted
duplication of network gameObjects of Photon on Client.
Is it necessary to clean up network gameObjects manually by calling PhotonNetwork.DestroyAll(); or cleanup by calling LeaveRoom() or Disconnect. Because when i joined room as a client after leaving room or disconnecting again join or connect as a client i get duplicated networks gameObjects.
Answer by ChristianSimon · May 04, 2017 at 10:24 AM
Hi,
cleaning up manually is usually not necessary, since this will be handled by the server. You can find more information about this in the section Lifetime of Networked Objects in the Instantiation documentation.
If you have duplicated game objects, you maybe have set PlayerTtl and EmptyRoomTtl to another value than 0 when creating the room. PlayerTtl describes the time the data of a disconnected client will be held in the server's memory before removing him. This allows to let this client rejoin the game. EmptyRoomTtl describes the time an empty room will be held in the server's memory before removing its data.
i am creating room using this code
private void CreateRoom(string roomName, string playerName)
{
if (playerName.Length <= 0 || roomName.Length <= 0)
{
return;
}
RoomOptions roomOptions = new RoomOptions {maxPlayers = (byte) $$anonymous$$axPlayersPerRoom, isVisible = true };
PhotonNetwork.player.name = playerName;
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
}
i didn't use PlayerTtl and EmptyRoomTtl anywhere in the code.
Do you set PhotonNetwork.autoCleanUpPlayerObjects to false somewhere in your code?
i set PhotonNetwork.autoCleanUpPlayerObjects to true in the Start().
you are right that cleaning up manually is usually not necessary, since this will be handled by the server. the problem was with my code and now working fine. Thanks for the help!
Follow this Question
Related Questions
Can't see other players on the server 1 Answer
Photon synchronization on different devices failes 0 Answers
Photon Networking - How to move all players from game scene to current room scene? 0 Answers
How to choose different teams one by one 1 Answer
Photon Voice chat and Speech to text plugin not working together 0 Answers