The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

PhotonNetwork.InstantiateRoomObject has owner != null?

2021-03-29 06:10:17


First time asking here and new to unity and PUN. I am trying to reconcile what I'm seeing here [] with what I am observing in the game.

A networked room object is a networked object that does not belong to an actor but it is a 'global networked object' belonging to the room. It has no owner (null), nor controller (null) and it is not a result of a PhotonNetwork.Instantiate call (but could be a result of PhotonNetwork.InstantiateRoomObject).

In my code, I have written this:

and the logs show:

The logs are when there is a single (MasterClient) connected.

Context: I am trying to get the MasterClient to create these "pickable" room objects that can be owned (and eventually destroyed) by the masterclient or other clients in the game. Any other pointers or tips would help!



2021-03-29 06:23:41

Forgot to mention. The prefab > PhotonView component has "Ownership Transfer" set to "Request".

2021-03-29 10:53:47

Please update to PUN 2.29 and try to reproduce.

2021-03-29 14:24:50

I think I am using it already. I took a quick peek at my changelog and it says -->

I am guessing this means I am already on this version (or do I have to manually switch current library version elsewhere too?).

2021-03-29 14:52:50

That doc is a bit misleading.
A room object has no owner by default but it's controlled by some client. The Master Client has control in the beginning. You can transfer ownership and control. So these values don't have to be null.

Use RequestOwnership() on a client that does not control the object to request ownership or the current controlling player can call TransferOwnership().

2021-03-29 15:10:37

Thanks Tobias for clarifying.

Is there a suggested way for tracking a photonview as currently unassigned? I tried TransferOwnership(null) and that didn't go well :)

In the game I'm developing, all players are "equal" and initial ownership to the MasterClient seems to break the logic. Each player is trying to claim the prize and ownership seems like the most natural and race condition free (hopefully) approach to this.

Is adding a ghosting player a good solution? When the prefab is instantiated, pass ownership immediately to this player and wait it to be truly claimed by one of the players?

Is there a different attribute that's better suited for this work?


2021-03-29 15:50:24

PUN uses distributed authority. There is no "unassigned" case. One of the clients has to simulate the object and produce a state for it. But the object does not have to move / do anything due to that.

It might make sense if you explain what you want to achieve over how you do it now and what you think is the problem :)

Back to top