Player & Room Properties

Coming from PUN I'm used to having things like room properties and player properties.

It would appear that there are no player properties in the sense I am used to, but there are SessionProperty in NetworkRunner.SessionInfo.Properties; although I am curios if this is the proper route.

Example: I need to set my player name, and get a name of everyone who has joined before me. Is the best route for this to send an RPC or to directly update the properties by reading what exists and updating it by calling UpdateCustomProperties?

Additionally, is there a callback for when those are updated so I can update previous players as well?

Answers

  • Hi,

    We have some samples that showcases nicknames: Razor Madness and Application Loop are the ones that came on my head.

    The way we usually do is to send a RPC from the client to the server (and only to the server) that set the nickname on a [Networked] NetworkString<_16> (_16 is the fixed size, you can use any other available). That way you can have the nickname sync across every client and even late joiners.

    "Additionally, is there a callback for when those are updated so I can update previous players as well?"

    Not sure if you're talking about the session properties, but networked properties has a OnChanged callback, you can see those being used on the samples.

    -----

    Isaac Augusto

    Photon Fusion Team