Skip to content

Game.ModificationBarrier3

Assembly:
Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary:
ModificationBarrier3 is a small system class that acts as a "modification barrier" in the engine's system update flow. It derives from SafeCommandBufferSystem and currently does not add any custom state or behavior beyond the base implementation. It overrides OnUpdate but only forwards to the base implementation. The class is marked with Preserve attributes on the constructor and the OnUpdate override and uses a MethodImpl attribute to prevent inlining of OnUpdate — common patterns to ensure the method is preserved by code stripping and keeps a stable call target for debugging or interop in modding scenarios.


Fields

  • This class declares no instance fields. Additional info: There are no private/internal fields defined in this type; any state or command-buffering behavior is provided by the SafeCommandBufferSystem base class.

Properties

  • This class declares no public properties. Additional info: Any properties related to command-buffering, producer handles, or timing would be inherited from the base type if present.

Constructors

  • public ModificationBarrier3() This constructor is parameterless and empty. It is annotated with [Preserve], indicating the constructor should not be stripped by Unity's code stripping. No custom initialization logic is executed in the constructor; initialization is expected to occur in lifecycle methods inherited from the base class (e.g., OnCreate).

Methods

  • protected override void OnUpdate() : System.Void
    Attributes: [MethodImpl(MethodImplOptions.NoInlining)], [Preserve]
    This override simply calls base.OnUpdate() and contains no additional logic. The NoInlining attribute prevents the method from being inlined by the JIT, and Preserve prevents it from being removed by linkers. In practice, this class acts as a named barrier/system for ordering: it ensures the base system's update behavior runs at this named point in the update sequence, which can be important for modders relying on deterministic ordering of command buffer application.

Usage Example

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

public class ModificationBarrier3 : SafeCommandBufferSystem
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    [Preserve]
    protected override void OnUpdate()
    {
        // Keep default behavior provided by the base system.
        base.OnUpdate();

        // If you need to perform additional work at this barrier,
        // add it here (but be careful to respect ordering and safety).
        // Example (pseudo):
        // ProcessPendingModifications();
    }

    [Preserve]
    public ModificationBarrier3()
    {
        // No custom construction logic; Preserve prevents stripping.
    }
}

Notes for modders: - This class is effectively a placeholder / ordering barrier — extend it only if you need to insert custom behavior at this point in the update loop. - The Preserve and NoInlining attributes are used to make the method stable and avoid code stripping; keep them if you rely on this exact method remaining present in builds. - Any command-buffer or job-handle management should follow the patterns established by SafeCommandBufferSystem (the base class).