RoomOptions: PublishUserID not publishing userIDs...

Hey there

I ran into an issue with creating a room and publishing the player's userID.
This is the code we use to create the room:


RoomOptions roomOptions = new RoomOptions();
roomOptions.IsVisible = false;
roomOptions.PublishUserId = true;
roomOptions.MaxPlayers = Convert.ToByte(roomCreationRoomSettings.MaxPlayers);


However, when trying to access the user ID of another player in the room, it says its null.
We use custom authentication in our game where the server returns a defined userID for the player and for the local player, the userID and nickname are set correctly. So it seems like the userIDs are not broadcasted correctly?
Version of PUN we're using: 1.80.



Any ideas on how to get the userIDs broadcasted in the room?
Thanks in advance! :)

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @juniordiscart,

    I can't reproduce, what's in the AllProperties hashtable?
    Can you try with more recent PUN version?
  • juniordiscart
    edited September 2017
    HI @JohnTube

    I updated our Photon version (1.86 now) and created a very minimal setup of connecting to Photon and joining a room. I also disabled our back-end system in the chain, and I keep experiencing the issue. I also created a new project, pulled Photon from the asset store and placed the code on a gameobject in an empty scene and no user IDs are sent.

    So I made a scene with just one 1 Gameobject along with the code provided below. In the screenshot you can see the output in my editor where the nickname is sent, but the UserId remains empty for remote players. Between the brackets the player's UserId should appear in the second log.


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    using ExitGames.Client.Photon;

    public class MinimalPhoton : Photon.PunBehaviour
    {
    private void Start()
    {
    AuthenticationValues authValues = new AuthenticationValues();
    //authValues.AuthType = CustomAuthenticationType.Custom;
    authValues.UserId = System.Guid.NewGuid().ToString().Substring(0, 8);
    PhotonNetwork.player.NickName = System.Guid.NewGuid().ToString().Substring(0, 8);

    PhotonNetwork.AuthValues = authValues;
    PhotonNetwork.lobby = null;
    PhotonNetwork.autoJoinLobby = false;
    PhotonNetwork.ConnectUsingSettings("0.0.1");
    }

    public override void OnConnectedToMaster()
    {
    if (Application.isEditor)
    {
    RoomOptions roomOptions = new RoomOptions();
    roomOptions.IsVisible = true;
    roomOptions.IsOpen = true;
    roomOptions.PublishUserId = true;
    roomOptions.MaxPlayers = 5;

    string roomName = System.Guid.NewGuid().ToString().Substring(0, 8);

    PhotonNetwork.CreateRoom(roomName);
    }
    else
    {
    PhotonNetwork.JoinRandomRoom();
    }
    }

    public override void OnJoinedRoom()
    {
    Debug.Log("Joined room");
    }

    public override void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
    {
    Debug.Log("Player joined: " + newPlayer.NickName + "(" + newPlayer.UserId + ")");
    }
    }



  • JohnTube
    JohnTube ✭✭✭✭✭
    edited September 2017
    You are not passing the roomOptions.
    Replace
    PhotonNetwork.CreateRoom(roomName);
    with
    PhotonNetwork.CreateRoom(roomName, roomOptions, TypedLobby.Default);
  • HI @JohnTube

    Thanks for pointing that out. I was pulling out my hair as to why it didn't work that I overlooked the fact that I never even used the variable...
    Thank you very much for this obvious mistake. I'll go crawl under my desk and sob for a moment...
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @juniordiscart,

    We all have been there don't worry about it.