Skip to content

Game.Common.ModificationBarrier2

Assembly: Assembly-CSharp (typical game assembly for Cities: Skylines 2 mods)
Namespace: Game.Common

Type: class

Base: SafeCommandBufferSystem

Summary:
ModificationBarrier2 is a lightweight subclass of SafeCommandBufferSystem that exists to provide a named barrier/system used when scheduling or applying safe command buffer modifications. It does not add its own state or custom behavior beyond calling the base implementation of OnUpdate. Both the override and the constructor are annotated with Preserve attributes (and the OnUpdate override is marked NoInlining), indicating they are preserved for runtime/linker and should not be inlined.


Fields

  • None
    This type declares no instance or static fields.

Properties

  • None
    This type declares no additional properties beyond those provided by its base class.

Constructors

  • public ModificationBarrier2()
    Attributes: [Preserve]
    Notes: Default parameterless constructor. It does not perform any initialization beyond what the base class constructor does.

Methods

  • protected override void OnUpdate() : System.Void
    Attributes: [MethodImpl(MethodImplOptions.NoInlining)], [Preserve]
    Summary: Overrides the base SafeCommandBufferSystem.OnUpdate and simply calls base.OnUpdate(). No extra update logic is implemented here — the override exists to provide a distinct system that can be referenced or scheduled independently within the game's system ordering.

Usage Example

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

namespace Game.Common;

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

    [Preserve]
    public ModificationBarrier2()
    {
    }
}

Additional notes: - Because this class doesn't add state or behavior, it's typically used as a named synchronization point in the game's system update ordering (for example, other systems may require this specific barrier to have run before they apply their command buffers). - The [Preserve] attribute is important for modding contexts where code stripping/linker steps might remove unused methods/types; it ensures the constructor and OnUpdate remain available at runtime.