Problem with FriendList isOnline
Options
Hi, I have a problem with PhotonNetwork.Friends list. It always says that player is online, even if I'm logged on second client with the same name. Everything is commented in code. Please help me ASAP
Here's a code on pastebin http://pastebin.com/MftpSawv (Bad things happen at 17 line)
Here's a code on pastebin http://pastebin.com/MftpSawv (Bad things happen at 17 line)
public void Login() //activated by button { string login = loginClass.nicknameInput.text; // get my nickname from inputfield string password = loginClass.passwordInput.text; // get my password from inputfield nickname = login; //just set variable PhotonNetwork.FindFriends(new string[] { nickname }); // find me in lobby to check if I am online loginClass.nicknameInput.interactable = false; // disable player to change values of inputfield loginClass.passwordInput.interactable = false; // disable player to change values of inputfield } public void OnUpdatedFriendList() { print(PhotonNetwork.Friends[0].Name); print(PhotonNetwork.Friends[0].IsOnline); // show my status StartCoroutine(CheckIfLogged()); IEnumerator CheckIfLogged() { if (PhotonNetwork.Friends[0].IsOnline) // check if my nickname is already in lobby (here's error, { //it is always false, even if i am logged in another client of game loginClass.nicknameInput.text = ""; //reset nickname inputfield loginClass.passwordInput.text = ""; //reset password inputfield loginClass.Warning.text = "Already logged!"; // show warning yield return new WaitForSeconds(1.0f); loginClass.Warning.text = ""; // reset wawning text loginClass.nicknameInput.interactable = true; //enable player to change values of inputfield loginClass.passwordInput.interactable = true; //enable player to change values of inputfield } else { PhotonNetwork.playerName = nickname; // set my nickname SetMenuState(2); // switch to main menu } }
0
Comments
-
You need to set PhotonNetwork.playerName before connecting to Photon. Otherwise lobby would not be able to put the name into its lists.0
-
EDIT: 99% sure it has something to do with since I'm using PlayFab with custom auth..
If you don't mind the necro bump, I'm in the same situation -- I am sure to fill my PhotonNetwork.playerName BEFORE I connect. I can see my friend online, and I'm not just calling myself I'm calling a list of friends that's NOT me so it definitely has their name or it wouldn't even show up, right?vadim said:You need to set PhotonNetwork.playerName before connecting to Photon. Otherwise lobby would not be able to put the name into its lists.
The friend shows, but is always offline.
0 -
Hi @xblade724,
I see the issue you are having.
You need to use UserId / PlayFabId instead of playerName (Nickname) / DisplayName to find friends.
Please set the userId first before connecting:AuthenticationValues customAuth = new AuthenticationValues(pfid);
orcustomAuth.UserId = pfid;
2 -
Worked like a charm, mate ;D That was EXACTLY it!JohnTube said:Hi @xblade724,
customAuth.UserId = pfid;
1