player identifier HELP-MEE!!!

Options
Hello guys,

I created a char customization script, and consequently as it has up to 6 players in a room, I ended up creating 6 versions of the script plus 6 canvas panel ... ie 6 game object's, but I happen to need to when entering the room the game identifies its respective customizer, example player 1 + customizer 1, player 2 + perzonalizer2 ... and so on, but I have no idea how to create a script for it .. what I currently use is


if (PhotonNetwork.countOfPlayers == 1)
if (PhotonNetwork.countOfPlayers == 2)

, but it happens that after the masterclient, if 2 people enter together in the game, before entering the room. account as playercount == 3. so the customization 3 appears both pro player 2 and player 3, already tried the

if (PhotonNetwork.room.playerCount == 1)
if (PhotonNetwork.room.playerCount == 2)


but it happens exactly the same thing, could someone help me in this matter?

Comments

  • Hi @Drakunnio,

    please take a look at the PlayerRoomIndexing script that is included in the PUN package. I guess it will help you achieving what you want to have. Basically you have to attach this script as a component to a game object in the scene and add a handler to the RoomIndexingChanged event. Whenever this one gets called, something related to the PlayerRoomIndexing changed and you can update your game accordingly.