Rotating cube
Click the cube to start or stop it for everyone. The clicking player takes ownership, flips the synced bool, and every player's copy spins locally with Time.deltaTime.
RotatingCube.cs
using StageTime.SDK;
using UnityEngine;
/// <summary>
/// Spins while the synced <see cref="spinning"/> flag is on. Clicking the cube (Interact) toggles it for everyone:
/// the clicking player takes ownership first, so the change is theirs to sync.
/// </summary>
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;
}
}