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.

How do not destroy objects when the owner exit

2019-08-31 12:41:24

Hello everyone, I am working on a multiplayer game. And I ran into a small problem, my game is a sandbox, something similar to minecraft, and I create objects using PhotonNetwork.Instantiate, and as I later noticed, I do it wrong, because when a player comes out, all the objects created by him destroyed, maybe i must use the PhotonNetwork.InstantiateSceneObject ? But it creates objects only if player is a MasterClient, but I need all players to create objects without exception, maybe i need make some kind of request should be made to the MasterClient? If so, how ???? But in short, my question is: How not to destroy objects when their owner leaves ?

Thank you in advance !!! :)

P.S : Sorry for my English :/


2019-09-02 09:27:39

Hi @Feelkep,

Thank you for choosing Photon!


  • creating rooms with roomOptions.CleanupCacheOnLeave = false
  • transfer ownership before leaving

2019-09-02 11:39:12

Thank you for quickly answer !
I tried use roomOptions.CleanupCacheOnLeave = false; , and it worked, instantiated objects don't destroy, it is cool, but when I try disconnect from photon(just close game) my player don't destroed, maybe I must use special destroy for my player?

Here video demonstration :

2019-09-02 11:57:33

Wait for you answer ! :)

2020-01-19 16:22:56

The problem is solved, if anyone is interested I will tell about it:

The problem was solved through the InstantiateSceneObject method, and it works fine, the problem was in my function which destroy the my player prefab, I did not do it right exit from server therefore my player prefab does not could be removed from room, and now my player correctly destroyed, but his instantiated objects don't remove, this result fine me :) Hope this answer help you :D
P.S Sorry for my English :)

Back to top