ScriptAPI source

Working Examples

Browse practical scripts for interaction, triggers, dialogs, players, media, lights, materials, audio, animation, spritesheets, spawning, sitpoints, script events, and chat commands. Code blocks are loaded from the raw .cs files in this folder.

ScriptAPI / Examples

Example Index

These examples are given to show acceptable patterns for user-uploaded scripts on the Simuspaces platform. The current script API is the very first version, and alot more system object types and features will be added soon. If you are searching for something specific, use the filter search box below to narrow the examples list shown below.

Dialogs / Callbacks

DialogDemo

Shows success and error dialogs, including an OK/Cancel result callback.

Raw .cs
Loading DialogDemo.cs...

Dialogs / Target Users

TargetedDialogCallback

Targets a dialog at a named user and handles the selected button result.

Raw .cs
Loading TargetedDialogCallback.cs...

Interaction / Self Object

InteractableSelf

Makes the script object clickable and shows a dialog when a user interacts with it.

Raw .cs
Loading InteractableSelf.cs...

Objects / SceneObject

SceneObjectReference

Uses a SceneObject field, hides its renderer, and reports the target id.

Raw .cs
Loading SceneObjectReference.cs...

Objects / Lights

LightControl

Light controller that toggles an animated light loop from an interactable object.

Raw .cs
Loading LightControl.cs...

Materials / Emission Lists

MaterialEmissionListDemo

Uses public List<> inspector fields to control material emission color and intensity for multiple scene objects.

Raw .cs
Loading MaterialEmissionListDemo.cs...

Media / URL

MediaScreenUrl

Registers a click target and changes a media screen URL for one screen id or all screens.

Raw .cs
Loading MediaScreenUrl.cs...

Players / Emotes

PlayerEmoteControl

Alternate emote toggle pattern using an Emote field and flexible username targeting.

Raw .cs
Loading PlayerEmoteControl.cs...

Players / Scale

PlayerScale

Interactable that toggles scale for the clicking user, everyone, or a named target.

Raw .cs
Loading PlayerScale.cs...

Users / Lifecycle

UserJoinPart

Overrides user join and part callbacks for simple presence logging.

Raw .cs
Loading UserJoinPart.cs...

Users / Enumeration

ForEachUser

Runs a repeating coroutine that logs active users through ForEachUser.

Raw .cs
Loading ForEachUser.cs...

Script Events / Sender

PostScriptEventsSender

Posts global and grouped script events with structured name/value data.

Raw .cs
Loading PostScriptEventsSender.cs...

Script Events / Receiver

PostScriptEventsReceiver

Listens to global and grouped script events and reads typed payload values.

Raw .cs
Loading PostScriptEventsReceiver.cs...

Chat / Slash Commands

ChatCommandRouter

Listens for a custom slash command, reads the sender and arguments, and adds a [Script] chat response.

Raw .cs
Loading ChatCommandRouter.cs...

Triggers / Self Object

TriggerSelf

Registers enter and exit callbacks on the script object.

Raw .cs
Loading TriggerSelf.cs...

Triggers / Target Object

TriggerSceneObjectSlot

Registers enter and exit callbacks on a SceneObject trigger slot.

Raw .cs
Loading TriggerSceneObjectSlot.cs...

Triggers / Audio

NamedTriggerSoundOnce

Plays a target audio source when a matching object enters a trigger, with name filtering and cooldown.

Raw .cs
Loading NamedTriggerSoundOnce.cs...

Triggers / Reset

ResetTrigger

Resets players with TeleportPlayer and dynamic rigidbodies with transform client commands.

Raw .cs
Loading ResetTrigger.cs...

Audio / Motion

MotionReactiveSound

Samples object movement and drives audio pitch, volume, playback, and stop behavior.

Raw .cs
Loading MotionReactiveSound.cs...

Animation / Legacy Control

Rollercoaster1

Controls a legacy Animation with synced random frame, play, and stop interactions.

Raw .cs
Loading Rollercoaster1.cs...

Spritesheets / Hints

Spritesheet

Variant of the spritesheet button example with interaction hint text.

Raw .cs
Loading Spritesheet.cs...

Inventory / Spawning

UltimateInventorySpawner

Spawns an inventory item from a click target, caps total spawned objects, and despawns after a timeout.

Raw .cs
Loading UltimateInventorySpawner.cs...

Sitpoints / Occupancy

SitpointDetection

Responds to user sit and stand events for a watched sitpoint.

Raw .cs
Loading SitpointDetection.cs...

Sitpoints / Input

SitpointVehiclePrototype

Registers sitpoint input and applies movement forces to build a prototype vehicle controller.

Raw .cs
Loading SitpointVehiclePrototype.cs...