Skip to main content

Your first world

This walks you from an empty scene to a world with a clickable, synced cube.

1. Create the world scene​

  1. File → New Scene and save it, e.g. as MyFirstWorld.unity. The scene is your world.
  2. Create an empty GameObject at the top of the scene, name it after your world and add ST World (reference).
  3. Add a floor: 3D Object → Plane.
  4. Add an empty object named SpawnPoint where players should appear (its blue Z axis is the facing direction) and drag it into Spawn Point.
  5. Optional: create a material with the Skybox/Procedural shader and drag it into Skybox.
  6. Open StageTime SDK → Build Window, sign in, press Use Open Scene and give the world a Name in Details.

Everything in the world must be in this scene. The scene's camera is left out of the build: StageTime brings its own.

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;
}
}

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)​

  1. Add a UI → Canvas inside the world, set Render Mode to World Space, and scale it down (e.g. 0.001).
  2. Add a UI → Button - TextMeshPro to it.
  3. 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.