Skip to content

Component variables ​

Component variables are String Field, Boolean, Integer, or Float attributes added to a component. These types appear in the Variables group of the Add attribute menu because Arcscript treats them as variables scoped to that component.

Use a component variable from anywhere in the project by joining the component's custom ID and the variable's custom ID with a dot:

arcscript
hero.health -= 10

Unqualified names resolve global variables only. For example, health and hero.health can coexist and store different values.

Create component variables ​

  1. Find the component in the Components section of the sidebar.
  2. Click the component to open the component editor.
  3. Click Add attribute and select String Field, Boolean, Number > Integer, or Number > Float from the Variables group.
  4. Enter the variable's label and initial value.

The component already has a custom ID generated when the component was created. Arcweave generates the variable's custom ID from its label. Their Arcscript reference appears as component_custom_id.variable_custom_id.

Component folders cannot contain attributes or variables.

Use component variables ​

Component variables can be read and changed from anywhere in the project. Their component custom ID is a namespace, not an access restriction.

A component variable belongs to the component itself. Attaching the component to multiple elements does not create separate copies of the variable or its value.

See Common use cases for assignment, branch, and dynamic-text examples.

Edit component and variable custom IDs ​

The component's custom ID appears beneath its name in the component editor. Select it to edit the scope used by all variables on that component.

To edit a variable's custom ID, open its three-dot menu and select Edit Custom ID. The variable label is for people reading the project; its custom ID is the member name used in Arcscript.

Renaming either the component or attribute custom ID updates existing Arcscript references automatically. Custom IDs cannot be empty and must follow the variable naming rules.

Manage component variables ​

Open the component editor from the Components section or from an element where the component is attached. From there, you can:

  • Drag variables to reorder them.
  • Rename a variable or edit its custom ID from its three-dot menu.
  • Delete a variable from its three-dot menu.

See Attributes for full instructions.

Find and debug component variables ​

Project Search can find a component variable by its label or custom ID and open the owning component.

In Play Mode, the Debugger groups component variables under the component's name and custom ID and shows their current values.

See Play Mode > Debugger for full instructions.