Skip to content

Game.ModificationBarrier2B

Assembly: Assembly-CSharp
Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary: ModificationBarrier2B is a minimal barrier-type SafeCommandBufferSystem used by the game's ECS-style update flow to provide a synchronization point for safe modification command buffering. The implementation currently does not add custom behavior beyond calling the base class OnUpdate; attributes applied to the constructor and OnUpdate prevent code stripping and method inlining (useful for runtime/linker behavior in the game's mod environment).


Fields

  • (none)
    This class declares no instance or static fields.

Properties

  • (none)
    This class exposes no custom properties.

Constructors

  • public ModificationBarrier2B()
    This constructor is marked with [Preserve] in the source to avoid removal by code stripping. The constructor performs no custom initialization beyond what the base class provides.

Methods

  • protected override void OnUpdate() : System.Void
    This method is marked with MethodImplOptions.NoInlining and [Preserve]. Its current implementation simply calls base.OnUpdate() and does not add additional logic. The method exists to provide an override point if custom update behavior or additional synchronization is required in the future.

Usage Example

using UnityEngine.Scripting;
using System.Runtime.CompilerServices;
using Game.Common;

// Original minimal class as implemented in the game assembly
public class ModificationBarrier2B : SafeCommandBufferSystem
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    [Preserve]
    protected override void OnUpdate()
    {
        base.OnUpdate();
    }

    [Preserve]
    public ModificationBarrier2B()
    {
    }
}

// Example of obtaining/using the barrier from another system
public class MyExampleSystem : SystemBase
{
    private ModificationBarrier2B modificationBarrier;

    protected override void OnCreate()
    {
        base.OnCreate();
        // Get or create the barrier system from the World
        modificationBarrier = World.GetOrCreateSystem<ModificationBarrier2B>();
    }

    protected override void OnUpdate()
    {
        // Ensure we call or schedule jobs that respect the barrier.
        // This system can schedule work that depends on modifications
        // accumulated by the barrier or use the barrier to flush commands.
    }
}