Search Unity

Only master Client is spawned when spawning with team.Code

Discussion in 'Multiplayer' started by Johan_Liebert123, Oct 3, 2022.

  1. Johan_Liebert123

    Johan_Liebert123

    Joined:
    Apr 15, 2021
    Posts:
    474
    Hey all, so currently I'm spawning players based on their Actor Numbers, and it works fine, spawns all players, like so
    Code (CSharp):
    1. PhotonNetwork.Instantiate("Player Shooting", spawnPoints[PhotonNetwork.LocalPlayer.ActorNumber].position, Quaternion.identity);
    to get the players current team, I use this
    Code (CSharp):
    1. team = PhotonNetwork.LocalPlayer.GetPhotonTeam();
    and I use this to spawn them
    Code (CSharp):
    1.  PhotonNetwork.Instantiate("Player Shooting", spawnPoints[team.Code].position, Quaternion.identity);
    What happens is the MasterClient will spawn at the correct location, I've changed the order up of the spawn points and it changes each time, meaning the code above reads the players team code correctly, however, other players arent spawned and the
    PhotonNetwork.Instntiate
    line returns null, theres no reason for it to return null because when the player joins the room, it correctly debugs the team they joined
    upload_2022-10-3_12-16-25.png
    upload_2022-10-3_12-11-43.png

    And both players can be seen on the PhotonTeamsManager


    Why is it returning null?