PUN destroys owned GameObjects on disconnect.

Options
Hello,

Is there a way to easily prevent photon from destroying my player character on remote clients when i disconnect from the game? I would like to handle things a little bit better than just having the character suddenly pop out of the game for other players, like some FX spawning, the death animation playing on the character before it leaves, or even having an AI play the character instead, that kind of thing... I found the place in the PUN scripts where the character gets destroyed, but if there's a better way than just tweaking that, I'm all ears!

thanks for your help =D

Comments

  • Hi @DandS,

    you can do this when before creating the room.
    RoomOptions options = new RoomOptions();
    options.CleanupCacheOnLeave = false;
    When creating the room use these RoomOptions as parameter. If CleanupCacheOnLeave is enabled, leaving a room will behave as before. Means that a client's events and properties get removed from the room cache including all of his Instantiation calls. If CleanupCacheOnLeave is disabled the clean up step is not processed and all the client's data remain in the server's memory. This is described here.
  • DandS
    Options
    Thanks a lot, this is exactly what i was looking for =D