[pun2] transfer ownership (takeover)

Hello, I want to:

  1. Check if Owner is me, if it’s not, then get it.

  2. Save previous owners IDs (or something I will need later).

  3. Do something with this objects.

  4. When done, return objects to previous owners.

How can I do this? Especially, their IDs - how to get it and how to save?

if (!photonView.isMine)
{
Player previousOwner = photonView.Controller;
photonView.RequestOwnership();

DoSomething();

photonView.TransferOwnership(previousOwner);
}
else
DoSomething();

Something along those lines, most likely in a coroutine, I don’t remember if you have to wait for the ownership request to be processed to be able to do anything. You might have to implement IPunCallbacks.OnOwnershipRequest() depending on the object.