SetOnlineStatus(int) | Not Setting Online

edited June 2019 in Photon Chat

Just switched from PUN2 friends to Chat friends system. All is working great with chat except friends status update for some reason.

My system is as follows:
void DebugPlayerOnlineStatus() {
            if (Input.GetKeyDown(KeyCode.F1)) {
            if (Input.GetKeyDown(KeyCode.F2)) {
            if (Input.GetKeyDown(KeyCode.F3)) {

(First i pressed F2, then F3, then finally, F1)
void IChatClientListener.OnStatusUpdate(string user, int status, bool gotMessage, object message) {
    Debug.LogError("<b>" + user + "</b> set online status to <b>(" + status + ") " + ReturnOnlineStatus(status) + "</b>" + (gotMessage ? (message != null ? message.ToString() : "") : ""));
Those responses are from the other client. However, it seems whenever the other client presses F1 key, it sends a 0 as the parameter which in turn returns what you see in the image.

Here is the return values for the int parameter:
public static string ReturnOnlineStatus(int status) {
            string onlineStatus = string.Empty;
            switch (status) {
                case 1:
                    onlineStatus = "Online";
                case 2:
                    onlineStatus = "AFK";
                case 3:
                    onlineStatus = "DND";
                    onlineStatus = "Offline";
            return onlineStatus;
I dont really know what im doing wrong here and why its not sending the online state.

(NOTE: There is no other code calling SetOnlineStatus(int) in my code, i cross-referenced in visual studio and the scene hierarchy itself)


  • Hi @GLucas,

    Photon Chat has some reserved or special user status values like 0 (offline), 1 (invisible) and 2 (online).
    There is a class called ChatUserStatus with all predefined values.
    You can add other different custom ones of course.
  • Ah i see. That makes much more sense for some reason i didnt come across that in the setup documentation.
Sign In or Register to comment.