Your first world
This walks you from an empty prefab to a world with a clickable, synced cube.
1. Create the world prefab
- Create an empty GameObject, name it after your world and add ST World (reference).
- Set World Id (lowercase, e.g.
my-first-world) and Version (e.g.1). Bump the version every time you publish a change. - Add a floor: 3D Object → Plane, as a child of the world root.
- Add an empty child named
SpawnPointwhere players should appear (its blue Z axis is the facing direction) and drag it into Spawn Point. - Optional: create a material with the
Skybox/Proceduralshader and drag it into Skybox. - Drag the root into the Project window to save it as a prefab.
Everything in the world must be inside this prefab.
2. Add a script
Create RotatingCube.cs:
using StageTime.SDK;
using UnityEngine;
public class RotatingCube : StageTimeBehaviour
{
public float degreesPerSecond = 90f;
[Synced] private bool spinning = true;
private void Update()
{
if (spinning) transform.Rotate(0f, degreesPerSecond * Time.deltaTime, 0f);
}
public override void Interact()
{
Networking.SetOwner(Networking.LocalPlayer, gameObject);
spinning = !spinning;
}
}
Open the prefab, add a Cube (it already has a collider, which Interact needs) and add the RotatingCube
component to it. That's all: there is no extra proxy component to add.
3. Add a button (optional)
- Add a UI → Canvas inside the world, set Render Mode to World Space, and scale it down (e.g.
0.001). - Add a UI → Button - TextMeshPro to it.
- In the Button's On Click (), drag in the cube and choose RotatingCube → Interact.
Players click buttons with the crosshair on desktop and the laser in VR. See UI and interaction.
4. Build and try it
Press Play to click the cube in the local preview, then press Build & Test (desktop) in StageTime SDK → Build Window to try it in StageTime. See Build and test.