Skip to main content

UI and interaction

Clicking objects​

Override Interact() in a script on an object with a collider. Players click it with the crosshair on desktop and the laser in VR; the text shown when pointing at it is the script's InteractionText.

UI buttons​

Use normal Unity UI on a world-space Canvas inside your world:

  1. UI → Canvas, Render Mode: World Space, scaled down (e.g. 0.001).
  2. Add Buttons, Sliders, Toggles and TextMeshPro text as usual.
  3. In a Button's On Click (), drag in the object with your script and pick the method, e.g. Counter → Increment. Any public method with no parameters works.

There is nothing else to add: the builder makes every canvas with buttons clickable (it adds ST Interactable Canvas) and turns each On Click into a call to your script.

tip

On Click targets must be your scripts' public, parameterless methods. Other targets (for example GameObject.SetActive) are rejected by the builder: call them from a script method instead.

Reading UI values​

Scripts can read and set UI state directly:

public Slider volume;
public Toggle music;

public void ApplySettings()
{
audioSource.volume = volume.value;
audioSource.mute = !music.isOn;
}