Don't destory GameObject on Player Disconnect

Options
So I'm having a Scene in Unity where all players (6 players) spwan a Character with Photonnetwork.Instantiate(), and I want all the Characters to be in the Scene until the game ends (60 seconds) even if any player disconnects. So obviously as I checked if any player disconnects his Character gets destroyed in the Scenes of the other players.

Is there any option to keep them in the Scene with Photon code? Like DontDestroyOnDisconnect() or something?

Comments

  • I'm not extremely familiar with Photon, but I don't think a function like that exists. However, you'd just have to change the owner of the game object upon disconnection, unless it doesn't give you enough time before it's destroyed. Check that out and see if it suits you.
  • kamend
    Options
    If you instantiate them with: PhotonNetwork.InstantiateSceneObject() they won't be destroyed, this is how we instantiate our NPCs.
  • Thanks for the fast answers :smile: It worked out with PhotonNetwork.InstantiateSceneObject()
  • I have the same issue, when another player disconnect her prefab stills on scene
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @ConceptFactory,

    Thank you for choosing Photon!

    How do you instantiate those prefabs?
    What PUN version are you using?