PUN v2 Ownership Callbacks
Options
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
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
0
Comments
-
Hi @vinnie@vivace.co.nz,
Did you:
CallPhotonNetwork.AddCallbackTarget(this)
andPhotonNetwork.RemoveCallbackTarget(this)
from the class that implementsIPunOwnershipCallbacks
.
You could use MonoBehaviour'sOnEnable()
andOnDisable()
.1 -
oh man. you are right, forgot that somewhat important step!!
Thanks heaps.0