LUIDA Docs

SetText

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

SetText(text)StableItem Manipulation
Fires
On State Start · During State · On State Exit

Description

Sets text on a child 'Text' sub-node.

Parameters

No parameters.

Side effects

  • Calls $.subNode("Text").setText(text) on the item. The item must have a child GameObject named exactly Text with a TextView (or compatible) component.
  • Purely visual — no state keys, no signals, no $.groupState, no callExternal.
  • If the Text sub-node is missing or doesn't expose setText, the runtime logs a warning (Error in SetText: ... Ensure a 'Text' sub-node exists and has setText method.) and continues; the action never throws.

Example

In Tutorial 3 (Stroop), the Instruction × Trial - Start cell uses two SetText actions, each gated on the request within-subject variable, so the displayed instruction adapts per trial:

// On State Start, gated by request === "font"
SetText("Click the button that matches the text's font color.");

// On State Start, gated by request === "meaning"
SetText("Click the button that matches the text's meaning.");

The same item also calls ShowItem() on enter and HideItem() on exit so the text only appears during the active state. Combined with the if toggle in the editor, this is how LUIDA conditionalizes content without a Customized Action.

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md