Skip to content

Game.Rendering.PreRenderSystem

Assembly: Assembly-CSharp
Namespace: Game.Rendering

Type: class

Base: GameSystemBase

Summary:
PreRenderSystem is a game system that runs immediately before rendering. It coordinates rendering preparation by invoking the rendering system's PrepareRendering method and advances the UpdateSystem to the PreCulling update phase. Methods and the constructor are marked with [Preserve] to avoid stripping. This system retrieves required sibling systems from the World via GetOrCreateSystemManaged during creation.


Fields

  • private RenderingSystem m_RenderingSystem
    Holds a reference to the game's RenderingSystem. Acquired on creation via World.GetOrCreateSystemManaged() and used in OnUpdate to prepare rendering.

  • private UpdateSystem m_UpdateSystem
    Holds a reference to the game's UpdateSystem. Acquired on creation via World.GetOrCreateSystemManaged() and used in OnUpdate to run the PreCulling update phase (SystemUpdatePhase.PreCulling).

Properties

  • None
    This system exposes no public properties.

Constructors

  • public PreRenderSystem()
    Parameterless constructor. Marked with [Preserve] in source to prevent code stripping; performs no additional initialization beyond what GameSystemBase provides.

Methods

  • protected override void OnCreate()
    Called when the system is created. Calls base.OnCreate(), then initializes m_RenderingSystem and m_UpdateSystem by retrieving or creating the corresponding managed systems from the World:
  • m_RenderingSystem = World.GetOrCreateSystemManaged()
  • m_UpdateSystem = World.GetOrCreateSystemManaged()

  • protected override void OnUpdate()
    Called every frame (or according to the game's system scheduling). Performs the pre-render work by:

  • Calling m_RenderingSystem.PrepareRendering() to prepare rendering data/state.
  • Calling m_UpdateSystem.Update(SystemUpdatePhase.PreCulling) to execute update logic for the PreCulling phase.

Usage Example

[Preserve]
protected override void OnCreate()
{
    base.OnCreate();
    // Obtain references to sibling systems for later use
    m_RenderingSystem = World.GetOrCreateSystemManaged<RenderingSystem>();
    m_UpdateSystem = World.GetOrCreateSystemManaged<UpdateSystem>();
}

[Preserve]
protected override void OnUpdate()
{
    // Prepare rendering and perform the PreCulling update phase
    m_RenderingSystem.PrepareRendering();
    m_UpdateSystem.Update(SystemUpdatePhase.PreCulling);
}