Photon.Instantiate not spawning players on other clients

21 Views Asked by At

I created a session manager script that instantiates the players in session,but when a players joins after other players, he can se the other players in the scene, but the players that were present in the room before the described player, A new player and photon view won't be instantiated This is my script :

    void Start()
{
    if (PhotonNetwork.IsConnectedAndReady)
    {
        if (PhotonNetwork.LocalPlayer.IsMasterClient)
        {
            PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Player"), hostPosition.position,
                Quaternion.identity);
        }
        else
        {
            Player[] players = PhotonNetwork.PlayerList;
            int index = 0;
            for (int a = 0; a < players.Length; a++)
            {
                if (players[a].ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber)
                {
                    index = a;
                }
            }

            PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Player"),
                membersPositions[index].position, Quaternion.identity);
        }
    }
}

I tried just simplifying the code like this :

void Start(){
            PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Player"), hostPosition.position, Quaternion.identity);

}

but has no use, the results stayed the same, Has anyone encountered an issue like this ? I don't know how to solve this any more !

0

There are 0 best solutions below