Cannot get PhotonView IsMine value after PhotonNetwork instantiate when other players join

Viewed 222

I have a function called Spawn and I put it in Start function. The problem is I can only print out the IsMine value when I create the room. When other plays join the value won't be printed out. And all the code below the instantiate line will not be executed. How do I fix this or am I doing it wrong, is there a correct way to instantiate? Thanks for your help!

public GameObject Player;
// Start is called before the first frame update
void Start()
{
    Spawn();
}   
void Spawn(){
    GameObject player = PhotonNetwork.Instantiate(Player.name, Vector3.zero, Quaternion.identity);
    PhotonView photonView = player.GetComponent<PhotonView>();
    print(photonView.IsMine);
}
0 Answers
Related