Skip to content

EntitySerializer.CreateSnapshot(Entity) Method

Definition

Namespace: Brine2D.ECS.Serialization

Creates a snapshot of an entity.

C#
public Brine2D.ECS.Serialization.EntitySnapshot CreateSnapshot(Brine2D.ECS.Entity entity);

Parameters

entity Entity

Returns

EntitySnapshot

Remarks

Only components are persisted. Behaviors are not serialized; they must be re-applied after restore \(e\.g\., by instantiating through a prefab and then restoring component state, or by re\-adding behaviors manually\).

ID remapping:Id captures the entity's runtime ID so that RestoreWorldFromSnapshot\(IEntityWorld, WorldSnapshot\) can rebuild parent–child hierarchy. Restored entities receive brand-new runtime IDs; the snapshot ID is not re-injected. Any component that stores a cross-entity reference as a System.Int64 ID will hold a stale value after restore. Re-resolve such references by name or tag instead.