How can I show the score
Options
wolf1212
✭
When creating the room in the 1st scene, I want to set a value such as the score, and when this score goes to the 2nd stage, I want to show the score. I know some about photon, can you help me?
0
Best Answer
-
Hi @wolf1212,
Thank you for choosing Photon!
According to the stacktrace you are calling this in Update, so it's not clear what is the client state.
But from the error message the client is not joined to a room and is even on the NameServer which should not happen when leaving the room, unless you disconnect and reconnect.
SetCustomProperties works only when joined to a room.1
Answers
-
if (PhotonNetwork.IsMasterClient) { Hashtable setRoomProperties = new Hashtable(); setRoomProperties.Add("GameMode", "GameMode"); setRoomProperties.Add("AnotherProperty", "AnotherProperty"); PhotonNetwork.CurrentRoom.SetCustomProperties(setRoomProperties); }
When I add this code it gives an error when leaving the room
Operation SetProperties (252) not allowed on current server (NameServer)
UnityEngine.Debug:LogError(Object)
Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2382)
Photon.Realtime.LoadBalancingClient:CheckIfOpCanBeSent(Byte, ServerConnection, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2305)
Photon.Realtime.LoadBalancingClient:OpSetPropertiesOfRoom(Hashtable, Hashtable, WebFlags) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1985)
Photon.Realtime.Room:SetCustomProperties(Hashtable, Hashtable, WebFlags) (at Assets/Photon/PhotonRealtime/Code/Room.cs:397)
menuManager:Update() (at Assets/Scripts/menuManager.cs:48)
menuManager:Update() (at Assets/Scripts/menuManager.cs:48)PhotonNetwork.CurrentRoom.SetCustomProperties(setRoomProperties);
0 -
Hi @wolf1212,
Thank you for choosing Photon!
According to the stacktrace you are calling this in Update, so it's not clear what is the client state.
But from the error message the client is not joined to a room and is even on the NameServer which should not happen when leaving the room, unless you disconnect and reconnect.
SetCustomProperties works only when joined to a room.1 -
thank you for your answers
0