Specified cast is not valid

Options

Hello everyone

I just had a question of why can't you find the RoomProperties in the Awake/Start function

I'm been using this

currentGameMode = (GameMode)PhotonNetwork.CurrentRoom.CustomProperties[PropertiesKey.GameModeKey];

Thanks!

Answers

  • Tobias
    Options

    The custom properties of a room are known when you joined the room. There is a callback for the moment at which they become available and usable.

    The subject of the post implies there is a cast exception. The GameModeKey might be available but doesn't have the value you expect and can't be cast?! Debug this in VS and look into the CustomProperties if they contain the values you expect.