UI

UiLabel

Text UI node.

Label node for UI text.

Base node: UiBox

Source: perro_source/core/perro_ui/src/lib.rs

Fields

textalignfont_sizecolor
pub struct UiLabel {    pub base: UiBox,    pub text: String,    pub align: UiTextAlign,}

Scene template

[node_instance]tags = ["runtime", "demo"]parent = @rootscript = "res://script.rs"script_vars = { speed = 4.0, health = 100 }   [UiLabel]    text = "Start"    align = 0    font_size = 0    color = #ffffff  [/UiLabel][/node_instance]

Script API

Create

let node_id = create_node!(ctx, UiLabel, "Spawned Node", ["enemy", "runtime"], parent_id);

Access / mutate

let value = with_node!(ctx, UiLabel, node_id, |node| {    node.text}); let pair = with_node!(ctx, UiLabel, node_id, |node| {    (node.text, node.align)}); with_node_mut!(ctx, UiLabel, node_id, |node| {    node.text = "Start".to_string();});