The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to get and compare the custom properties of all players inside a room?

2022-03-24 14:52:04

Hello, I'm trying to create a basic multiplayer game using Photon. I apologize if this is a silly question but I've been stumped already for 2 days. Inside the room, there should be an equal number of player for team 1 and team 2 before the button on the master client should be set to active. This button is what takes all the players to the actual game scene.

Each player has a custom property:

each players can then set their team through a button

teams.Length is just 2 = 0 and 1. "0" is Team 1 while "1" is Team 2. This code is saved on a prefab playerItem.

On another script, the only conditions for my button is just this:

TLDR; I want the play button to only be active if there are equal numbers of players inside the room with a custom properties of: playerPropTeam[playerTeam] = 0 and playerPropTeam[playerTeam] = 1

appreciate any help thanks!


2022-03-28 07:17:06

Welps we can use:

to access a custom property of local player in another script and make a system around that xD

Back to top