Search Unity

Third Party PhotonNetwork.JoinRoom(passing some params??)

Discussion in 'Multiplayer' started by udik, Oct 20, 2014.

  1. udik

    udik

    Joined:
    Oct 9, 2013
    Posts:
    37
    Hi guys,

    Is there a way to pass params to the JoinRoom, such as (name, mood, joke of the day, character type) that will show up and can be retrived on the OnJoinedRoom() callback?

    Thanks,
    Udi
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    You want to set some values that refer to the player/character?
    Use PhotonNetwork.player.SetCustomProperties(). Set them before you join and they get synced in the room.
    You can access the values as PhotonPlayer.customProperties. Just don't modify this hashtable! Use SetCustomProperties to change a player's values.

    The player list should be available in OnJoinedRoom(). In worst case, a moment later. I am not 100% sure when we do the callback and when we fill the player list.
    In any case, access players via PhotonNetwork.playerList or .otherPlayers.
     
  3. udik

    udik

    Joined:
    Oct 9, 2013
    Posts:
    37
    Thanks! I will try that!