Restarting Level Problem
Options
Hello everyone so i have game that has some rounds and after round is ended master restarts the game and loads same map. i have problem with clients for master everything is ok but for client game is not restarted and all the players are there in the game
PhotonNetwork.automaticallySyncScene = true;
PhotonNetwork.LoadLevel(samemap);
also everything is ok if i load different scene. did anyone have problem like this ?
PhotonNetwork.automaticallySyncScene = true;
PhotonNetwork.LoadLevel(samemap);
also everything is ok if i load different scene. did anyone have problem like this ?
0
Comments
-
Your issue could be related to this bug:
http://forum.photonengine.com/discussion/comment/25471/#Comment_25471
I described a simple fix. Can you try that and see if that helps?
Another hint: All clients have to set automaticallySyncScene = true, not only the Master Client which loads the new scene (while all others will follow without explicit call to LoadLevel() by your logic).0 -
i have tried all kind of thing but nothing helped for master is loaded same level with no problem but for clients it not happening i have
public void LoadNextMap()
{
Debug.Log("Loading New Level");
RoomOptions roomOptions = new RoomOptions ();
roomOptions.maxPlayers = 10;
ExitGames.Client.Photon.Hashtable newProperties = new ExitGames.Client.Photon.Hashtable();
newProperties.Add( RoomProperty.BlueScore, 0 );
newProperties.Add( RoomProperty.RedScore, 0 );
newProperties.Add (RoomProperty.Map,(string)PhotonNetwork.room.customProperties[RoomProperty.Map]);
newProperties.Add (RoomProperty.Mode,(int)PhotonNetwork.room.customProperties[RoomProperty.Mode]);
PhotonNetwork.room.SetCustomProperties(newProperties);
PhotonNetwork.LoadLevel((string)PhotonNetwork.room.customProperties[RoomProperty.Map]);
}
and calling this function like this :
if( PhotonNetwork.isMasterClient == true )
{
LoadNextMap();
}
i have tested all demos that is in demo folder and the problem is same0 -
Hi,
Do you mean that you tested all demos and they do not work for you? Only DemoWorker uses PhotonNetwork.LoadLevel. So you need check this demo first.
If nothing helps, you may try to debug non-master clients by logging "curScn" property in OnPhotonCustomRoomPropertiesChanged handler when level is loading. Master simply updates this room property.0 -
OnPhotonCustomRoomPropertiesChanged is not even called on client in my case . if i load different level not the same everything works like a charm but if i want to load same level master loads client no0
-
i have tested it on Worker demo and the problem remains can you do same ? just load same level with PhotonNetwork.LoadLevel ?0
-
You need to set automaticallySyncScene to true on all clients.
Do you do that?
If we should take a look, please attach a minimal repro case for us. If we try to re-implement things on our own, I'm pretty sure it would work out.
Post a download link here or mail to: developer@exitgames.com and let us know that you refer to this thread.
Thanks.0 -
Worker Demo
here is a link for your worker demo and if you load level and only on master "Restart Level" button is on if you click on it it loads same level but it is loaded for only master for client not.0 -
Ow!
Now I got it.
Your remote clients don't re-load the scene they already loaded?!
I checked that case and found it happens by design but is also slightly buggy:
The idea is to avoid extra level loading, when the scene is already loaded. So when the Master Client notices that the room properties are already set to the current scene, it does not send the request to load the scene (again).
But (and here comes the bug), it does load the scene itself. This would be something I'd fix.
If you want to re-load the scene, do that with an RPC. It's easier than modifying PUN's level sync into what you want it to do.
See:
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent0