- Home /
Question by
danteson · Jul 22, 2021 at 04:10 PM ·
gameobjectphotonsetactive
How to activate game object over Photon?
Hi, My script:
if (GetComponent<Controller>().attacking) {
PhotonView photonView = PhotonView.Get(this);
photonView.RPC("SwordInHand", RpcTarget.All);
} else {
PhotonView photonView = PhotonView.Get(this);
photonView.RPC("SwordInSheath", RpcTarget.All);
}
}
[PunRPC]
void SwordInHand () {
sheathSword.SetActive(false);
handSword.SetActive(true);
return;
}
[PunRPC]
void SwordInSheath () {
sheathSword.SetActive(true);
handSword.SetActive(false);
return;
}
I can see sword in hand activating and diactivating on my back, when i attack. But other players dont. How do i fix it? Thanks!
Comment
did you confirm that the functions are really not called for the other players? Are the photon views on the player objects properly initialized with correct matching view IDs?