Skip to content

Game.Common.ModificationBarrier4B

Assembly:
{{ Assembly not specified in source file; likely part of the game's main assembly (e.g., Game.dll). }}

Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary:
ModificationBarrier4B is a lightweight command-buffer/system barrier class used by the game's runtime to provide a synchronization/ordering point for modification commands (likely related to jobified command buffers). In the provided implementation it does not add custom behavior — its OnUpdate override simply forwards to the base implementation. The class includes attributes to prevent AOT stripping ([Preserve]) and to control inlining behavior for the OnUpdate method (MethodImplOptions.NoInlining).


Fields

  • This class does not declare any fields. {{ This class is effectively a marker/forwarding system that relies on its base class for behavior; if you need per-instance state, add fields here. }}

Properties

  • This class does not declare any properties. {{ Use the base class's properties (SafeCommandBufferSystem) for producer/consumer handles or other synchronization data. }}

Constructors

  • public ModificationBarrier4B() {{ The parameterless constructor is decorated with [Preserve] in the source, ensuring it is preserved from IL stripping/AOT optimization. The constructor performs no additional initialization and relies on the base type for setup. }}

Methods

  • protected override void OnUpdate() {{ Attributes present in source:
  • [MethodImpl(MethodImplOptions.NoInlining)]: prevents the JIT/AOT from inlining this method, which can be useful for stack traces, debugging, or specific runtime behavior.
  • [Preserve]: prevents Unity's code stripping from removing this method/class.

Behavior: - The override only calls base.OnUpdate(), so all processing is delegated to SafeCommandBufferSystem. Override this method to inject custom logic before or after calling base.OnUpdate(), for example to enqueue commands, measure timing, or perform conditional updates. }}

Usage Example

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

namespace Game.Common
{
    public class ModificationBarrier4B : SafeCommandBufferSystem
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        [Preserve]
        protected override void OnUpdate()
        {
            // Insert any custom logic here (pre-update)
            base.OnUpdate(); // preserve base behavior: process/submit command buffer barrier
            // Insert any custom logic here (post-update)
        }

        [Preserve]
        public ModificationBarrier4B()
        {
            // No additional initialization required in this sample.
        }
    }
}

{{ Example shows the minimal pattern: preserve methods/ctor from stripping and call base.OnUpdate() to keep the barrier behavior. If you need additional functionality (timing, conditional execution, extra command enqueues), implement it around the base.OnUpdate() call. }}