How do not destroy objects when the owner exit
The whole answer can be found below.
Try Our
Documentation
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.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How do not destroy objects when the owner exit
Feelkep
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 :/
Comments
Hi @Feelkep,
Thank you for choosing Photon!
Try:
- creating rooms with
roomOptions.CleanupCacheOnLeave = false
- transfer ownership before leaving
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 : https://youtu.be/1uwQelO6Hy4
Wait for you answer ! :)
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 :)