Skip to content

Game.Common.ModificationEndBarrier

Assembly: Game
Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary:
ModificationEndBarrier is a thin barrier/system type that inherits from SafeCommandBufferSystem. Its OnUpdate override currently only forwards to the base implementation. The class and its methods are annotated with Preserve attributes to avoid stripping by Unity's code stripping tools; the OnUpdate method is also marked with MethodImplOptions.NoInlining to prevent the method from being inlined by the JIT/AOT compiler. This type appears intended to serve as a synchronization/command-buffer flush point at the end of modification work in the game's update pipeline.


Fields

  • This type declares no private or public fields.

Properties

  • This type declares no properties.

Constructors

  • public ModificationEndBarrier() {{ This is the default public constructor. It is annotated with [Preserve] to ensure the constructor is not removed by Unity's managed code stripping. The constructor performs no additional initialization. }}

Methods

  • protected override void OnUpdate() : System.Void
    {{ This override forwards to base.OnUpdate() and does not add any custom update logic. The method is annotated with [Preserve] to prevent stripping and [MethodImpl(MethodImplOptions.NoInlining)] to prevent inlining. In practice this means the barrier relies on the base SafeCommandBufferSystem implementation for its runtime behavior (e.g., flushing safely accumulated command buffers). }}

Usage Example

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

namespace Game.Common;

public class ModificationEndBarrier : SafeCommandBufferSystem
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    [Preserve]
    protected override void OnUpdate()
    {
        base.OnUpdate();
    }

    [Preserve]
    public ModificationEndBarrier()
    {
    }
}

{{ Notes: - The class contains no custom data or behavior beyond ensuring that a SafeCommandBufferSystem exists for the "modification end" stage. - Keep the [Preserve] attributes if you rely on this type being present at runtime (for example, when creating or referencing it via reflection or when code stripping is enabled). - The NoInlining attribute on OnUpdate may be used to guarantee a call boundary for profiling or to ensure that the method's identity remains intact for runtime hooking/patching. }}