Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Troubles with Photon Friends - Unity, Facebook sdk

$
0
0
Hello. I am developing a 2d multiplayer game. I am using facebook or my custom authentication. Everything is working with that. I have implemented my own friend system using playerprefs (adding, refreshing list ect..) however when I try to find friends, it always returns that they are not online, even if they are.

This is the flow for my game:

Menu > Login via facebook (set photon userid/token to the facebook information) > Load lobby level > Load friends from player prefs > FindFriends > Display information.

However when I display the information, it always says that they are offline. Am I missing something? Or do I need to do something specific because of the facebook integration? I have been stuck on this for sometime now so any help is appreciated.

After the friends are loaded from the playerpref string, this is called, and I have the friend list callback in another script that should print out some debug logs.

public void InitializeFriends()
{
if (_friendList != null)
{
string[] friends = _friendList.ToArray ();

PhotonNetwork.FindFriends (friends);
Debug.Log ("Tryna find friends");
}
}


void OnUpdatedFriendList()
{
Debug.Log ("OnUpdatedFriendList");
if (PhotonNetwork.Friends != null)
{
foreach (FriendInfo friend in PhotonNetwork.Friends)
{
Debug.Log ("Friend name: " + friend.Name + " Online: " + friend.IsOnline);
}
}
}

What im wondering is, why is it saying that the friends are offline even when they're online?
All of this is called once... Is FindFriends supposed to be called more then once? How can i properly setup/design this so it works efficiently.


Viewing all articles
Browse latest Browse all 15755

Trending Articles