photonView.IsMine == true in OnDestroy()?

Options
Hey guys, hope you're having a good weekend.

When the photonView belonging to a remote player has been destroyed without the remote player leaving the game, photonView.IsMine returns false in OnDestroy on the local client. This is correct.

However, when the remote player abruptly leaves the game, i.e. quits the application suddenly, photonView.IsMine returns true in OnDestroy on the local client, even though it belongs to the remote player. Why is this?

Comments

  • OldPilgrim
    edited April 2020
    Options
    I found the answer, it lies in the definition of IsMine.
            public bool IsMine
            {
                get
                {
                    // using this.OwnerActorNr instead of this.ownerId so that it's the right value during awake.
                    return (this.OwnerActorNr == PhotonNetwork.LocalPlayer.ActorNumber) || (PhotonNetwork.IsMasterClient && !this.IsOwnerActive);
                 }
            }
    

    When the remote player left the game, the local client became the master client. In addition, the owner of the remote player's photonView is inactive. Therefore, IsMine returned true for the remote player's photonView.

    Hopes this helps someone else.