PUN updating friends status

Options
Hi all,

I've been trying to set up Photon with Facebook authentication and so far the code just works. I'm populating an array with the player friends IDs which I'm passing to the FindFriends method. I'm calling this method when the player is in the lobby (not in a room) on the master server. The OnUpdatedFriendList method gets called as expected and I can go through the list of friends, however when two players are online, their status is not being updated (i.e. they both see each other as offline). Is there a flag that I need to set when successfully joining the lobby to notify the server (I presume this is automatically done by PUN). Can anyone shed some light on this please?
IEnumerator FindFriendsCoroutine ()	{
		if (friendsDict.Count == 0) {
			yield break;
		}

		string[] friendIds = new string[friendsDict.Count];
		friendsDict.Keys.CopyTo (friendIds, 0);

		while (true) {
			PhotonNetwork.FindFriends (friendIds);
			yield return new WaitForSeconds (5f);
		}
	}

void OnUpdatedFriendList (){
		Debug.Log ("Updating friends list");
		foreach (var friendInfo in PhotonNetwork.Friends) {
			Debug.Log (string.Format ("{0} is {1}", friendsDict [friendInfo.Name], friendInfo.IsOnline ? "online" : "offline"));
		}
	}

Comments

  • claytonc
    Options
    Did a quick test and the PhotonNetwork.countOfPlayersOnMaster returns 2 when the other player joins in. So I would expect that the online status gets updated for that player.
  • claytonc
    Options
    Can anyone shed some light on this please? I'm using version 1.53
  • vadim
    Options
    Do you set PhotonNetwork.playerName before connect?
    Seems like DemoFriendsAndCustomAuth demo has all what you need.