UICanvas

class in Infernux.ui

Inherits from: InxUIComponent

Description

Screen-space UI canvas — root container for all UI elements.

Defines a design reference resolution (default 1920x1080). At runtime the Game View scales from design resolution to actual viewport size so that all positions, sizes and font sizes adapt proportionally.

Attributes: render_mode: ScreenOverlay or CameraOverlay. sort_order: Rendering order (lower draws first). target_camera_id: Camera GameObject ID (CameraOverlay mode only). reference_width: Design reference width in pixels (default 1920). reference_height: Design reference height in pixels (default 1080). ui_scale_mode: Canvas scaler mode. screen_match_mode: Width/height match behavior for ScaleWithScreenSize. match_width_or_height: 0 = match width, 1 = match height. pixel_perfect: Round scale to integer pixels when possible. reference_pixels_per_unit: Sprite pixel density hint.

description

Properties

Name Type Description
render_mode RenderMode
sort_order int
target_camera_id int
reference_width int
reference_height int
ui_scale_mode UIScaleMode
screen_match_mode ScreenMatchMode
match_width_or_height float
pixel_perfect bool
reference_pixels_per_unit float

properties

Public Methods

Method Description
compute_scale(screen_w: float, screen_h: float) → Tuple[float, float, float] Compute (scale_x, scale_y, text_scale) for a viewport size.
invalidate_element_cache() → None Mark the cached element list as stale.
iter_ui_elements() → Iterator[InxUIScreenComponent] Yield all screen-space UI components on child GameObjects (depth-first).
raycast(canvas_x: float, canvas_y: float, tolerance: float = ...) → Optional[InxUIScreenComponent] Return the front-most element hit at (canvas_x, canvas_y), or None.
raycast_all(canvas_x: float, canvas_y: float, tolerance: float = ...) → List[InxUIScreenComponent] Return all elements hit at the given point, front-to-back order.

public_methods

Example

example

# TODO: Add example for UICanvas

See Also

see_also