Where I can call PhotonNetwork.autoCleanUpPlayerObjects?

Options
I need that when a player disconnects, his player object continues in the room, I have found this property but I do not know where to call it, I tried to put it when I created the room PhotonNetwork.autoCleanUpPlayerObjects = false;

Comments

  • DonWayo
    Options
    seriously, can anyone give me an example of where to call that?
  • Hi @DonWayo,

    you can use it before creating the room. You can also have a look at its description in source code;
    /// <summary>
    /// This setting defines per room, if network-instantiated GameObjects (with PhotonView) get cleaned up when the creator of it leaves.
    /// </summary>
    /// <remarks>
    /// This setting is done per room. It can't be changed in the room and it will override the settings of individual clients.
    ///
    /// If room.AutoCleanUp is enabled in a room, the PUN clients will destroy a player's GameObjects on leave.
    /// This includes GameObjects manually instantiated (via RPCs, e.g.).
    /// When enabled, the server will clean RPCs, instantiated GameObjects and PhotonViews of the leaving player, too. and
    /// Players who join after someone left, won't get the events of that player anymore.
    ///
    /// Under the hood, this setting is stored as a Custom Room Property.
    /// Enabled by default.
    /// </remarks>