OnStatusUpdate not firing !!

dibset
dibset
edited August 24 in Photon Chat
Hi, as the title suggests, OnStatusUpdate is not firing in my scene, BUT it works fine when i open the demo scene....I've been testing for days. Can someone please help ? I tried recreating the demo script but still doesn't work. Using the latest version of Photon.

1.ChatClient is connected
2.Friends add to chatclient .AddFriends correctly

public class PhotonChatManagerv2 : MonoBehaviour, IChatClientListener
{
 private void Start()
    {
        chatClient = new ChatClient(this);
        
    }
 private void Update()
    {
        if(chatClient !=null)
        {
            chatClient.Service();
        }
    }

 public void ConnectToPhotonChat()
    {  
        if (chatConnected)
        {
            return;
        }

        chatClient.AuthValues = new AuthenticationValues(Main.instance.userProfile.PlayfabID());
        ChatAppSettings chatSettings = PhotonNetwork.PhotonServerSettings.AppSettings.GetChatSettings();

        chatClient.ConnectUsingSettings(chatSettings); 
    }

 public void AddPhotonChatFriends(PlayFab.ClientModels.FriendInfo friendInfo)
    {
        photonChatFriendsList.Add(friendInfo.Username);
    }

    private void GetPhotonChatFriends()
    {
        if(photonChatFriendsList !=null && photonChatFriendsList.Count > 0)
        {
            chatClient.AddFriends(photonChatFriendsList.ToArray());

            foreach (var friend in photonChatFriendsList)
            {
                FriendsManager.instance.ShowFriends(friend);//instantiates Gameobject
            }
        }
    }

public void OnConnected()
    {
        chatConnected = true;
        GetPhotonChatFriends();
        chatClient.SetOnlineStatus(ChatUserStatus.Online);
        Debug.Log("You have connected to Photon Chat");
    }

public void OnDisconnected()
    {
        Debug.Log("You have disconnected from Photon Chat");
        chatConnected = false;
        chatClient.SetOnlineStatus(ChatUserStatus.Offline);
        PhotonChat_Reconnect();
    }

public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
    {
        // get list from friendsmanager 
        var friendListStatus = FriendsManager.instance.GetFriendsListStatus();

        if (friendListStatus.ContainsKey(user))
        {
            FriendListing _friendStatus = friendListStatus[user];

            if (_friendStatus != null)
            {
                _friendStatus.OnFriendStatusUpdate(status);
            }
        }
    }
}

Thanks

Best Answer

  • JohnTube
    JohnTube mod
    Accepted Answer
    Hi @dibset,

    Make sure you use the same PlayFab ID in Photon Chat as a UserId and as a friend ID.
    Also, make sure all clients (friends) are connected to the same region and same AppId/AppVersion.

Answers