why photonView.isMine works in Awake , and doesn't work in a public Method

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


//
 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

Comments

  • Hi @MostafaYahia,

    can you confirm, that Hit_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.
  • Hi @MostafaYahia,

    can you confirm, that Hit_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.

    so , why it is working well in Awake Function ! ,
    it is the same conditions there ! ?