Photon Pun UserID not set
Options
I have created a room, but other clients cannot join in. I found that I need to set the user ID by using PhotonNetwork.AuthValues. However, where should I add it? And how exactly the program is?
0
Comments
-
I believe you add it just before attempting to establish the connection (with `PhotonNetwork.ConnectUsingSettings()` for example) .
For example in my connect method:public void Connect() { // Generate random User id if (PhotonNetwork.AuthValues == null) { PhotonNetwork.AuthValues = new AuthenticationValues(System.Guid.NewGuid().ToString()); } else { PhotonNetwork.AuthValues.UserId = System.Guid.NewGuid().ToString(); } // we check if we are connected or not, we join if we are , else we initiate the connection to the server. if (PhotonNetwork.IsConnected) { OnConnectionValidated(); } else { // #Critical, we must first and foremost connect to Photon Online Server. PhotonNetwork.ConnectUsingSettings(); PhotonNetwork.GameVersion = m_GameVersion; } }
1 -
Thanks0