Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Ownership change - weird behaviour

$
0
0
Hi,

I´m experiencing weird behaviour when calling TransferOwnership() function on my shared scene object. After I call mentioned function, I´m observing behaviour of OnPhotonSerializeView() function and every time when stream.isWriting == true, I´m logging "OWNER" to the console. If the stream is not writing, I´m logging "NOT OWNER".

Let´s say I don´t own my object, but TransferOwnership() was just called and I want to become new owner. Expected behaviour is just simple switch between "NOT OWNER" and "OWNER" statement, but the real outcome is "NOT OWNER" -> "OWNER" -> "NOT OWNER" -> "OWNER". It looks like that ownership is changed twice instead of once. Is this correct behaviour? I thought it is possible that I call TransferOwnership() more than once, but I don´t and also Photon debug log "Ev OwnershipTransfer. ViewID 1 to: 2 Time: 359" is invoked only once. Could it be maybe some bug in Photon?

Also, what is the proper way to check if I am a owner of the object? Until now I was using function with this: this.photonView.ownerId == PhotonNetwork.player.ID, but I found out it doesn´t match the real situation. For example, my function tells me that I am a owner, but in fact I´m still reading from the stream in OnPhotonSerializeView(). Is there something more precise for checking?

Thanks in advance for any answers!

Viewing all articles
Browse latest Browse all 15755

Trending Articles