Does CleanupCacheOnLeave = false work? (Pun 2.7)

Hello.

The instantiation doc says "When a client leaves a room, the remaining players will destroy the GameObjects created by the leaving player. If this doesn't fit your game logic, you can disable this: Set the RoomOptions.CleanupCacheOnLeave to false, when you create a room."

But it looks like the GameObject instantiated by my second client is still automatically destroyed from my first client (master client) when the second client leaves the room.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @olistan,

    Check the value of CurrentRoom.AutoCleanUp to see if the RoomOptions.CleanupCacheOnLeave was properly set.
    Server-side, RoomOptions.CleanupCacheOnLeave will indicate if cached events by leaving actors should be removed or preserved.
    Additionally, PUN should check this value when a player leaves a room to know whether or not the GameObjects instantiated by that player should be destroyed or not.
  • Hi @JohnTube

    I printed the value of AutoCleanUp in OnJoinedRoom() and it is set to false.

    I found the reason: I am using DestroyPlayerObjects() on the second client. I had forgotten about that, sorry. I guess in this case the value of CleanupCacheOnLeave/AutoCleanUp is ignored.

    I will remove the call to DestroyPlayerObjects() and it should fix my issue.
  • Confirming that everything works as I want it when I don't call DestroyPlayerObjects() :).
    Sorry for the disturbance.