why photonView.isMine works in Awake , and doesn't work in a public Method
Options
Hello
i have a simple question
i need to print something , when this object is not mine
so it is working well in Awake
but doesn't work in other methods
that is my code
Code is working well
//
here it doesn't work
//
this method is used when a button pressed
thanks
i have a simple question
i need to print something , when this object is not mine
so it is working well in Awake
but doesn't work in other methods
that is my code
Code is working well
//
void Awake() { if (PhotonNetwork.isMasterClient) { if (photonView.isMine) { } else { print("Client is here "); } }//
here it doesn't work
//
public void Hit_other() { if (PhotonNetwork.isMasterClient) { print("Host is pressing "); if (!photonView.isMine) { print("notme"); }//
this method is used when a button pressed
thanks
0
Comments
-
Hi @MostafaYahia,
can you confirm, thatHit_other()
actually gets called? If so, please note, that the content of the function is only processed on the MasterClient (first condition) and when the MasterClient is not the Owner of the object (second condition). If this object is a scene object - either placed in the editor or instantiated by using PhotonNetwork.InstantiateSceneObject - the MasterClient is the Owner of this object by default. Means that the second condition will always be false, until the Ownership of the object is transferred to another client.0 -
so , why it is working well in Awake Function ! ,Christian_Simon said:Hi @MostafaYahia,
can you confirm, thatHit_other()
actually gets called? If so, please note, that the content of the function is only processed on the MasterClient (first condition) and when the MasterClient is not the Owner of the object (second condition). If this object is a scene object - either placed in the editor or instantiated by using PhotonNetwork.InstantiateSceneObject - the MasterClient is the Owner of this object by default. Means that the second condition will always be false, until the Ownership of the object is transferred to another client.
it is the same conditions there ! ?0