Can't get my rooms info

Options
I've managed to create a room, and when it is created it goes to a new scene, but in this scene I want to get the room info so it knows what map to go to as this room is a waiting room. I have made a custom room property for the map "m" and assigned it a string variable called sm. but when I add code to the waiting room scene to see the roominfo i get the error.

Assets\WaitingRoomController.cs(13,19): error CS0234: The type or namespace name 'RoomInfo' does not exist in the namespace 'Photon.Realtime' (are you missing an assembly reference?)

I found that this could be an issue with vsc code so I have uninstalled it and installed visual studio instead but that has not fixed it.

the code to create my room in my menu scene is:

public void CreateGame() {
RoomOptions options = new RoomOptions();
options.MaxPlayers = 12;
options.CustomRoomProperties = new Hashtable() {{"m", SM}};
PhotonNetwork.CreateRoom(CreateGameInput.text, options, TypedLobby.Default);
}

the code to check my room info in my waitingroom scene is:

void Start()
{
Debug.Log(Photon.Realtime.RoomInfo.ToString());
}

I have also tried:

void Start()
{
Debug.Log(Photon.Realtime.Room.RoomInfo.ToString());
}

Any help would be much appreciated, if you need to know anything else about the code please let me know

Comments

  • AlexUnity
    AlexUnity
    edited March 2021
    Options
    Hi, did you figure this out? I'm having the same problem, getting the room properties are not working.
    It is impressive that I can't find ANY info how to get room properties with a direct example, not even from the documentation, LOL.
  • Tobias
    Options
    Custom properties are mentioned in the doc for matchmaking and also on the page about Synchronization And State.

    The problem above is totally not about the properties as such. The error
    The type or namespace name 'RoomInfo' does not exist
    
    is about the code referencing other code.
    Normally, Unity should allow you to reference code from the Realtime API. You did add
    using Photon.Realtime;
    
    in your namespace or before the class?
    This may also be related to a bug in Unity, which did not write the project files correctly. You might want to try a different version of Unity. We can only recommend using a LTS version, such as 2020.3.x or 2019.4.x.
  • jamal1920
    Options
    Cheers @Tobias i figured it out it was just me using old versions of things but thanks anyway :smile: