Migrating to PUN and Player.guid

I'm migrating a project from Unity networking to PUN. In the existing code, data is associated with particular players via the Player.guid. To get things running, I switched those references to PhotonNetwork.player.ID.ToString()

I need a reliable method to match the data with the player. How does the player.ID persist? Do IDs get reused when a player exits and another joins? Or is it always incremented from the max ID?

If there is an equivalent guid to Unity's Player.guid, that would be great, but I haven't found it.


  • Per room, the player ID always starts with 1 and goes up. It's never re-used for another player.
    So this might be the ID you look for per room. It's not valid when you switch rooms!
    We are working on a re-join option, in which a client can enter a game again and provide the ID it had before. In this case, the user is still the same as before.

    You can set player values via SetCustomProperties and these get synced. On join, the values become available to everyone in the room, too.
  • I missed the response, so I'm just now seeing it.

    I managed to resolve the issue by adding a CustomProperty to store a GUID in. I've migrated some of the code to use only PlayerIDs, but it did get me up and running.

Sign In or Register to comment.