ModuleUI

Controls UI elements and their on-screen representation, including images, text, buttons, sliders, and navigation.

Overview

Does not draw directly in update; preRender clears command buffers; buildCommandsForViewport walks active scene GameObjects with Canvas / UIImage / UIText / UIButton / UISlider / UISheet components, computing screen rects (layout utils), producing UITextCommand and UIImageCommand vectors consumed by FontPass and UIImagePass during renderScene.

World-space canvas modes transform with canvas world matrix; screen-space overlays use orthographic projection in passes.

HUD canvas anchor presets and layout in the UI inspector
HUD canvas anchor presets and layout in the UI inspector
UISlider component with fill amount and anchor layout in the inspector
UISlider layout and fill driven through ModuleUI

How it works

  • preRender clears UI command buffers.
  • buildCommandsForViewport traverses scene UI components and builds draw commands.
  • ModuleRender::renderScene consumes commands in FontPass and UIImagePass.

Internal architecture

ModuleUI
├── Scene graph UI traversal
├── UITextCommand / UIImageCommand buffers
└── Integration with FontPass / UIImagePass

Relationships

  • ModuleEventSystem handles interaction; ModuleFont supplies glyphs; ModuleRender triggers build before GPU UI draws.

Technical features

  • Command-buffer UI architecture (text + image commands).
  • Supports world-space and screen-space canvas modes.
  • Layout utilities produce screen rects for UI components.

Implementation notes

  • Verified: command-buffer UI architecture tied to render passes.