Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

PutTeams. Last client playerlist empty

$
0
0
Greetings. 1st scene: lobby when players get to see their names in a list. When players join room they're assigned a team using PunTeams (Controller has PunTeams attached). When room's playersCount reaches maxPlayers value then second scene is loaded. 2nd scene: also has PunTeam component attached to controller which is responsible for spawning players.Every client is ok but last – PunTeam list is empty on new scene load for the last client joined the room. Team assignment: public class PlayerListUIController : Photon.PunBehaviour { public override void OnJoinedRoom() { PhotonNetwork.player.SetTeam(PunTeams.PlayersPerTeam[PunTeams.Team.red].Count >= PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count ? PunTeams.Team.blue : PunTeams.Team.red); } public override void OnPhotonPlayerConnected(PhotonPlayer otherPlayer) { if (PhotonNetwork.room.PlayerCount >= roomPlayerCount) { PhotonNetwork.LoadLevel(roomName); } } } In 2nd scene, I check the player's team, and it returns blue, but if I check PunTeams list it's empty and has no players, this is true only for last client who joined the room and was loaded in a scene.

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>