Skip to content

Game.ModificationBarrier4

Assembly:
Likely Assembly-CSharp (Unity game assembly). Confirm in project build if different.

Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary: ModificationBarrier4 is a lightweight system class that derives from SafeCommandBufferSystem. In the shipped source it provides no custom behavior beyond calling the base implementation of OnUpdate and exists primarily as a named barrier/system for ordering or to ensure a SafeCommandBufferSystem is present in the world. Attributes on the method and constructor (Preserve and NoInlining) indicate it is intended to be kept by Unity's code-stripping and to avoid inlining for stack/diagnostic reasons.


Fields

  • None declared in this source file. Provide any required fields via the base class (SafeCommandBufferSystem) if needed.

Properties

  • None declared in this source file. Any command-buffer related properties (producerHandle, etc.) are expected to come from SafeCommandBufferSystem.

Constructors

  • public ModificationBarrier4() This constructor is empty but decorated with [Preserve] in the source. The Preserve attribute prevents Unity's managed code stripping from removing this constructor/class when building player builds. The constructor simply ensures the system type can be instantiated by the ECS world.

Methods

  • protected override OnUpdate() : System.Void This override only calls base.OnUpdate() (no additional logic). The method in the source is decorated with:
  • [MethodImpl(MethodImplOptions.NoInlining)] — hints the JIT not to inline this method, which can be useful for preserving stack traces or ensuring the method appears as a distinct call for profiling.
  • [Preserve] — prevents Unity from stripping the method. Purpose: keep the SafeCommandBufferSystem update behavior present at this specific system type/name and provide a named insertion point in the execution order. If you need custom behavior, override OnUpdate in a derived class or modify this method.

Usage Example

// The system is normally discovered and created by the ECS world automatically.
// You can obtain it at runtime like this:

using Unity.Entities;
using Game.Common;

// Get or create the barrier system from the default world
var barrier = World.DefaultGameObjectInjectionWorld
                  .GetOrCreateSystem<ModificationBarrier4>();

// The system itself does not expose new members in this file.
// It exists to provide a SafeCommandBufferSystem instance with the name/ordering of ModificationBarrier4.
// To schedule or apply commands, use the base SafeCommandBufferSystem API (provided by the base class).

// Note: The class and its members are marked with [Preserve] to avoid stripping in player builds.