Question by
ANLevant · Mar 03 at 06:22 PM ·
networkingunityeditorpun
PhotonNetwork.LoadLevel Scene not loaded Goes back and forth on other clients
Hello!
I have this issue: After lobby, when players are ready, the MasterClient uses
PhotonNetwork.LoadLevel("IngameScene")
To move to the next scenne.
Clients other than Master initially switch to the scene, then go back to the lobby for some reason. Any idea of what can be happening?
This configuration is on:
PhotonNetwork.AutomaticallySyncScene = true;
Update
After debugging my code line by line, this error is being caused by the custom properties I'm writting during the Awake method. I moved them to the Start method but the error persists.
Here is my custom properties for this scene:
var userIdToObjectIdMap = new Dictionary<string, MechaNetworkDTOListWrapper>();
foreach (Player player in PhotonNetwork.PlayerList)
{
MechaNetworkDTOListWrapper mechaNetworkDtoListWrapper = new MechaNetworkDTOListWrapper();
userIdToObjectIdMap.Add(player.UserId, mechaNetworkDtoListWrapper);
}
PhotonNetwork.CurrentRoom.CustomProperties.Add(USER_ID_TO_OBJECT_ID_MAP_FIELD_NAME,
JsonConvert.SerializeObject(userIdToObjectIdMap));
PhotonNetwork.CurrentRoom.CustomProperties.Add(PLAYERS_ID_PLAYING_FIELD_NAME, "");
PhotonNetwork.CurrentRoom.CustomProperties.Add(IS_SHOOTING_FIELD_NAME, false);
PhotonNetwork.CurrentRoom.CustomProperties.Add(TIME_COUNTER_FIELD_NAME, 0f);
PhotonNetwork.CurrentRoom.CustomProperties.Add(WINNER_PLAYER_FIELD_NAME, "");
PhotonNetwork.CurrentRoom.CustomProperties.Add(CURRENT_PLAYER_TURN_INDEX_FIELD_NAME, -1);
PhotonNetwork.CurrentRoom.SetCustomProperties(PhotonNetwork.CurrentRoom.CustomProperties);
Comment