PUN v2 Ownership Callbacks

Hi all.

I'm trying to clarify the best approach to using Ownership callbacks. I understand how to take ownership of a Scene object.

I want to be able to detect when a PhotonView has changed ownership so I can have logic that checks, am I the new owner Yes or No.

I have implemented the IPunOwnershipCallbacks on my MonoBehaviour (parent of my PhotonView) however neither callback appears to be called despite successful ownership transfer.

As my PhotonView Owner is set to Takeover I understand OnOwnershipRequest would not fire (there was no request), but when the takeover is completed I would expect OnOwnershipRequest to.

There is no PUN v2 version of the Ownership Transfer Demo that exists in the Pun v1 documentation

https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/package-demos/ownership-transfer

cheers

Comments

  • Hi @[email protected],

    Did you:

    Call PhotonNetwork.AddCallbackTarget(this) and PhotonNetwork.RemoveCallbackTarget(this) from the class that implements IPunOwnershipCallbacks.
    You could use MonoBehaviour's OnEnable() and OnDisable().
  • oh man. you are right, forgot that somewhat important step!!

    Thanks heaps.
Sign In or Register to comment.