Photon + Playfab, friend online status

Alex_New
Alex_New
edited January 19 in Photon Chat

Halo...

I am new on Unity, Photon and Playfab.

I do the add friend fuction and friend list but the friend list cannot show the online status correctlly.

The debug log shows "ABC is online: False; in room: False ; room name: "

I am not sure if I missed something.

The code is shown as below:


[SerializeField] private string nickName;
private ChatClient chatClient; 
private void Awake(){
        nickName = PlayerPrefs.GetString("USERNAME");   
    }
 private void Start(){
        chatClient = new ChatClient(this);
        ConnectToPhotonChat();
    }
private void ConnectToPhotonChat(){
        chatClient.ChatRegion = "ASIA";
        int status = 2;
        chatClient.ConnectAndSetStatus(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat, PhotonNetwork.AppVersion, new AuthenticationValues(nickName),status); 


On another script called UIFriend:


[SerializeField] private TMP_Text friendNameText;
    [SerializeField] private FriendInfo friend;
    [SerializeField] private Color onlineColor;
    [SerializeField] private Color offlineColor;
public void Initialize(FriendInfo friend){
        Debug.Log($"{friend.UserId} is online: {friend.IsOnline}; in room: {friend.IsInRoom} ; room name: {friend.Room}");
        this.friend = friend;
        SetupUI();
    }
    private void SetupUI(){
        friendNameText.SetText(friend.UserId);
        if(friend.IsOnline){
            friendNameText.color = onlineColor;
        }else{
            friendNameText.color = offlineColor;
        }
    }

Comments

  • Hello bro, same issue.... Did you find how to solve this problem?