requestedView.OwnershipTransfer was ignored warning

Hi,
I'm using PUN2 to synchronize some game objects that players can move by hand in a VR game. I set the Photon Views of the objects to Takeover and call PhotonView.RequestOwnership() when a player grabs an object. Now I get the Warning "requestedView.OwnershipTransfer was ignored!" in the console. I could not seem to find any documentation on when that warning is thrown and in what circumstances this might be a problem. The synchronization (via Photon Transform Views) seems to work but I would like to know why that warning is printed. From looking at the code the warning points me too I wasn't able to figure that out.

Thanks in advance!

Unity Version 2020.1
PUN2 Free Version 2.23

Comments

  • The way we call Debug.Log means that the console is not always pointing to the correct code when you double click. You can look up parts of the string that gets logged, if you like to take a look around. Or check out the second to last line in the callstack.

    This error message will be about the PhotonView being setup as "Fixed" for ownership. You have to allow the transfer in general. Check the inspector for that setting. It helps avoid issues where anyone would requests any object (even if that never was planned).
  • I did double-check: The object by whose call to requestOwnership the warning is thrown is set to Takeover, not Fixed. However, for some reason the call still results in the warning, and the ownership is not changed (the owner & controller are null before and stay null after the interaction that triggers the request Ownership call).

    I looked at the correct code section that throws the warning but cannot wrap my head around why the request fails. Any thoughts on what I can try will be much appreciated.
  • sanket0_0jadhav
    edited February 2021
    I went through the PhotonNetworkPart's code and found out that this warning is printed if [(requestedFromOwnerId == currentPvOwnerId || (requestedFromOwnerId == 0 && currentPvOwnerId == MasterClient.ActorNumber) || currentPvOwnerId == 0) returns false]. may be you can get some direction here.

    if (requestedFromOwnerId == currentPvOwnerId || (requestedFromOwnerId == 0 && currentPvOwnerId == MasterClient.ActorNumber) || currentPvOwnerId == 0)
    {
    // a takeover is successful automatically, if taken from current owner
    Player prevOwner = requestedView.Owner;
    Player newOwner = CurrentRoom.GetPlayer(actorNr);

    requestedView.SetOwnerInternal(newOwner, actorNr);

    if (PhotonNetwork.OnOwnershipTransferedEv != null)
    {
    PhotonNetwork.OnOwnershipTransferedEv(requestedView, prevOwner);
    }

    // JF IPunOwnershipCallbacks callback handling refactoring
    //requestedView.OnOwnershipTransfered(requestedView, previousOwner);
    }
    else
    {
    Debug.LogWarning("requestedView.OwnershipTransfer was ignored! ");
    }