Game.DeserializationBarrier
Assembly:
Namespace: Game.Serialization
Type: class
Base: SafeCommandBufferSystem
Summary:
DeserializationBarrier is a small runtime system derived from SafeCommandBufferSystem intended to act as a synchronization/barrier point during deserialization-related work. The class itself does not add custom state or logic; it overrides OnUpdate and delegates to the base implementation. The override is marked with MethodImplOptions.NoInlining and the type/members are marked with Preserve to avoid Unity's code stripping, which is useful for modding scenarios where systems must remain available at runtime.
Fields
- This type declares no instance or static fields.
Properties
- This type declares no properties.
Constructors
public DeserializationBarrier()
The default public constructor is present and marked with [Preserve]. It performs no custom initialization.
Methods
protected override void OnUpdate()
Attributes: [MethodImpl(MethodImplOptions.NoInlining)], [Preserve]
The override simply calls base.OnUpdate() and does not add any extra behavior. By providing this override, the class exposes a named system that can be referenced or scheduled in system groups where a deserialization-phase barrier is needed.
Usage Example
namespace Game.Serialization
{
using System.Runtime.CompilerServices;
using UnityEngine.Scripting;
public class DeserializationBarrier : SafeCommandBufferSystem
{
[MethodImpl(MethodImplOptions.NoInlining)]
[Preserve]
protected override void OnUpdate()
{
base.OnUpdate();
}
[Preserve]
public DeserializationBarrier()
{
}
}
}
Additional notes: - Because the class contains no custom state, its main purpose is to act as a named synchronization point (barrier) in the game's system update order. Mods can reference this system by type to insert or rely on deserialization-phase ordering without needing to modify its implementation. - The Preserve attributes prevent Unity from stripping the type or its methods during builds, which is important for mod compatibility.