Nebula
Persistence

PersistAttribute

Marks a NetworkVariable<T> field as part of the entity's saved state.

generated from the sources
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class PersistAttribute : Attribute

Marks a NetworkVariable<T> field as part of the entity's saved state. The variable is written into the persistence blob under its discovered name ("<BehaviourTypeName>.<FieldName>") and assigning it also schedules the entity's next checkpoint, so a saved value is never more than a checkpoint behind what the simulation holds.

public sealed class Door : NetworkBehaviour
{
    [Persist] public NetworkVariable<bool> IsOpen = new NetworkVariable<bool>();
}

The entity itself opts in by carrying a PersistentEntity; without one, a PersistAttribute has no effect.