Breakroom is now Sinewave Campus. Book a meeting

SScript

ClientScene
On this classTypeName
  1. Functions
  2. TypeName
  3. TrackingAllowed
  4. TrackingRequest
  5. GetResource
  6. LogEvent
  7. Log
  8. Properties
  9. Inventory
  10. Persistence
  11. Scene
  12. Grid
  13. Host
  14. Physics
  15. Math
  16. String
  17. Input
  18. Camera
  19. WebServices
  20. Network
  21. PostFX
  22. AudioAnalyser
  23. Tween
  24. UI
  25. Dialogues
  26. Shared
  27. Quests
  28. Economy
  29. Groups
  30. Activity
  31. RenderSettings
  32. Profile
  33. Photos
  34. Videos
  35. MusicDirectory
  36. Journey
  37. GameTester
  38. RuntimeType
  39. Platform
  40. SessionID
  41. InEditor
  42. Version
  43. FullVersionString
  44. Resources
  45. Time
  46. ServerTime
  47. LocalTime
  48. LoginTime
  49. ServerTimeUnix
  50. LocalTimeUnix
  51. DeltaTime
  52. PreviewServer
  53. ComponentName
Members 51
FunctionTypeNameReturn the type name of the value.
FunctionTrackingAllowedReturns true on white-label grids when the user has opted into tracking for the given key.
FunctionTrackingRequestDisplays a consent prompt (EULA-style) asking the user to allow tracking for a given key.
FunctionGetResourceReturns a reference to a SResource using it's Resource name.
FunctionLogEventLogs an analytics event to the server on white-label grids.
FunctionLogLog a message to console.
PropertyInventoryAllows access to the users inventory
PropertyPersistenceStores information between user sessions, and for other users
PropertySceneAllows access to the current scene graph (objects and avatars in the scene, and other information)
PropertyGrid–
PropertyHostAccess information about the current scripting runtime host
PropertyPhysicsCall physics-related commands, and variables, such as raycasting
PropertyMathMath related functions (Sin, Cos, Tan, etc)
PropertyStringMiscellaneous additional string functions (e.g. MD5Sum)
PropertyInputInput device related functions (mouse position, keyboard state)
PropertyCameraTake and control the users camera
PropertyWebServicesCall remote web services to designated hosts (will not work with arbitrary domains, see page for details)
PropertyNetworkSend data to other clients through the region server
PropertyPostFX–
PropertyAudioAnalyser–
PropertyTween–
PropertyUI–
PropertyDialogues–
PropertyShared–
PropertyQuests–
PropertyEconomy–
PropertyGroups–
PropertyActivity–
PropertyRenderSettings–
PropertyProfile–
PropertyPhotos–
PropertyVideos–
PropertyMusicDirectory–
PropertyJourney–
PropertyGameTester–
PropertyRuntimeTypeReturn current RuntimeType name.
PropertyPlatformReturn current platform name.
PropertySessionIDReturn current SessionID.
PropertyInEditorReturn true if in unity editor.
PropertyVersionReturns the numeric build version of the viewer (for programmatic comparisons).
PropertyFullVersionStringReturns the full build version display string tied to release notes (e.g., "2025.6f210").
PropertyResources–
PropertyTimeReturns time at the beginning of this frame.
PropertyServerTimeReturns current server time.
PropertyLocalTimeReturns current local time.
PropertyLoginTimeReturns how long player has been logged in (in seconds).
PropertyServerTimeUnixReturns the server time unix timestamp.
PropertyLocalTimeUnixReturns the local time unix timestamp.
PropertyDeltaTimeThe completion time in seconds since the last frame.
PropertyPreviewServerReturn true if in preview server.
PropertyComponentNameThe name of this component.

Functions​

TypeName​

string TypeName(DynValue dv)

Return the type name of the value.

Parameters

NameTypeDefault
dvDynValue–

Returns

string

Example

Lua
typeName = Space.TypeName("123")

TrackingAllowed​

bool TrackingAllowed(string key)

Returns true on white-label grids when the user has opted into tracking for the given key. Always returns false on the main grid.

Parameters

ParameterTypeDescription
keystringA unique identifier used to store and look up the user's tracking consent.

Returns

bool

Example

Lua
isTrackingAllowed = Space.TrackingAllowed('3423423423423')

TrackingRequest​

void TrackingRequest(string key, string privacynotice, Closure callback, bool force = false)

Displays a consent prompt (EULA-style) asking the user to allow tracking for a given key. On white-label grids, stores the user's choice and invokes the callback with a boolean indicating consent. On the main grid, this does nothing.

Parameters

ParameterTypeDescription
keystringA unique identifier used to store and look up the user's tracking consent.
privacynoticestringThe privacy notice text to display in the consent dialog.
callbackClosureA function invoked with one boolean parameter: true if allowed, false otherwise.
forceboolIf true, show the prompt even if a stored decision exists. Defaults to false.

Returns

void

Example

Lua
-- Request consent (white-label only). The callback receives a boolean 'allowed'.
Space.TrackingRequest('24234234234234', 'A notice message', function(allowed)
if allowed then
Space.Log("Tracking allowed")
else
Space.Log("Tracking denied")
end
end)
-- or force re-prompt even if a decision was saved previously:
Space.TrackingRequest('24234234234234', 'A notice message', function(allowed) end, true)

GetResource​

SResource GetResource(string name)

Returns a reference to a SResource using it's Resource name.

Parameters

ParameterTypeDescription
namestringName of the Resource as set in the Scripting Runtime Component (Resources section)

Returns

SResource

Example

Lua
aResource = Space.GetResource("ResourceName")

LogEvent​

void LogEvent(string eventName, float value, SVector position)

Logs an analytics event to the server on white-label grids.

Parameters

ParameterTypeDescription
eventNamestringThe name of the analytics event.
valuefloatA numeric value associated with the event.
positionSVectorA world position to associate with the event.

Returns

void

Example

Lua
Space.LogEvent('event name', 2.0, Vector.New(0,0,0) )

Log​

void Log(DynValue text, bool logToFile = false)
void Log(string text, bool logToFile = false)

Log a message to console.

Parameters

NameTypeDefault
textDynValue–
logToFileboolfalse
textstring–

Returns

void

Example

Lua
Space.Log(Color.Blue)
--or
Space.Log("Log")
--or
Space.Log("Log",true)

Properties​

InventoryRead only​

SInventory Inventory {get; }

Allows access to the users inventory

Example

Lua
inventory = Space.Inventory

PersistenceRead only​

SPersistence Persistence {get; }

Stores information between user sessions, and for other users

Example

``` persistence = Space.Persistence ```

SceneRead only​

SScene Scene {get; }

Allows access to the current scene graph (objects and avatars in the scene, and other information)

Example

Lua
scene = Space.Scene

GridRead only​

SGrid Grid {get; }

Example

Lua
grid = Space.Grid

HostRead only​

SHost Host {get; }

Access information about the current scripting runtime host

Example

Lua
host = Space.Host

PhysicsRead only​

SPhysics Physics {get; }

Call physics-related commands, and variables, such as raycasting

Example

Lua
physics = Space.Physics

MathRead only​

SMath Math {get; }

Math related functions (Sin, Cos, Tan, etc)

Example

Lua
Space.Math.Ceil(4.0)

StringRead only​

SString String {get; }

Miscellaneous additional string functions (e.g. MD5Sum)

Example

Lua
Space.String.GetBytes("some data")

InputRead only​

SInput Input {get; }

Input device related functions (mouse position, keyboard state)

Example

Lua
Space.Input.Vibrate(1,1,false)

CameraRead only​

SCameraManager Camera {get; }

Take and control the users camera

Example

Lua
obj = Space.Host.ExecutingObject
Space.Camera.LockCamera (obj)

WebServicesRead only​

SWebService WebServices {get; }

Call remote web services to designated hosts (will not work with arbitrary domains, see page for details)

Example

Lua
Space.WebServices.GetImage("example.com/mrlee.jpg")

NetworkRead only​

SNetwork Network {get; }

Send data to other clients through the region server

Example

Lua
Space.Network.SubscribeToNetwork("helloworld", gotAMessageFunction)

PostFXRead only​

SPostFX PostFX {get; }

Example

Lua
Space.PostFX

AudioAnalyserRead only​

SAudioAnalyser AudioAnalyser {get; }

Example

Lua
Space.AudioAnalyser

TweenRead only​

STween Tween {get; }

Example

Lua
Space.Tween

UIRead only​

SUI UI {get; }

Example

Lua
ui = Space.UI

DialoguesRead only​

SDialogues Dialogues {get; }

Example

Lua
dialogues = Space.Dialogues

SharedRead only​

SShared Shared {get; }

Example

Lua
shared = Space.Shared

QuestsRead only​

SQuests Quests {get; }

Example

Lua
quests = Space.Quests

EconomyRead only​

SEconomy Economy {get; }

Example

Lua
economy = Space.Economy

GroupsRead only​

SGroup Groups {get; }

Example

Lua
groups = Space.Groups

ActivityRead only​

SActivity Activity {get; }

Example

``` activity = Space.Activity ```

RenderSettingsRead only​

SRenderSettings RenderSettings {get; }

Example

Lua
renderSettings = Space.RenderSettings

ProfileRead only​

SProfile Profile {get; }

Example

Lua
profile = Space.Profile

PhotosRead only​

SPhotos Photos {get; }

Example

Lua
photos = Space.Photos

VideosRead only​

SVideos Videos {get; }

Example

Lua
videos = Space.Videos

MusicDirectoryRead only​

SMusicDirectory MusicDirectory {get; }

Example

Lua
musicDirectory = Space.MusicDirectory

JourneyRead only​

SJourney Journey {get; }

Example

Lua
journey = Space.Journey

GameTesterRead only​

SGameTester GameTester {get; }

Example

Lua
gameTester = Space.GameTester

RuntimeTypeRead only​

string RuntimeType {get; }

Return current RuntimeType name.

Example

Lua
runtimeType = Space.RuntimeType

PlatformRead only​

string Platform {get; }

Return current platform name.

Example

Lua
platform = Space.Platform

SessionIDRead only​

string SessionID {get; }

Return current SessionID.

Example

Lua
sessionID = Space.SessionID

InEditorRead only​

bool InEditor {get; }

Return true if in unity editor.

Example

Lua
isInEditor = Space.InEditor
Lua
--the below script checks if we are in Unity editor or in SS
--this way we can provide an alternative
--(Example: if we're using a function that doesn't work in Unity editor)

thisGameObject = Space.Host.ExecutingObject


if Space.InEditor then
avatarUsername = "Player Name"
else
avatarUsername = Space.Scene.GetAvatar(thisGameObject.Owner).Username --example: this doesn't work in Editor
end

Space.Log(avatarUsername)

VersionRead only​

int Version {get; }

Returns the numeric build version of the viewer (for programmatic comparisons). In the Unity Editor this returns int.MaxValue; if unknown at runtime it returns -1.

Example

Lua
viewerVersion = Space.Version

FullVersionStringRead only​

string FullVersionString {get; }

Returns the full build version display string tied to release notes (e.g., "2025.6f210"). Best for user-facing display and logging.

Example

Lua
viewerVersionString = Space.FullVersionString

ResourcesRead only​

SResource[] Resources {get; }

Example

Lua
tableOfResources = Space.Resources
Lua
--the below script will search through the Scripting Runtime's resources
--and return the first instance of an Animation Clip
--[You need to add a few resources to the scripting runtime and make one of them an animation]


resources = Space.Resources

for i = 1, #resources do
if resources[i].Type == "AnimationClip" then
Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
break
end
end

TimeRead only​

float Time {get; }

Returns time at the beginning of this frame.

Example

Lua
floatTime = Space.Time
Lua
--this script will update a UIText object with the current local time without using a coroutine
--(example: clock )
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

rateUpdate = 1.0
nextUpdate = 0.0
text = Space.Host.GetReference("Text").UIText


OnUpdate = function()
if Space.Time > nextUpdate then
nextUpdate = Space.Time + rateUpdate
text.Text = Space.LocalTime
end
}

Space.Host.ExecutingObject.OnUpdate(OnUpdate)

ServerTimeRead only​

string ServerTime {get; }

Returns current server time.

Example

Lua
serverTime = Space.ServerTime
Lua
--this script will update a UIText object with the current server time (UTC)
--(example: clock)
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

co = function()
while true do
text.Text = Space.ServerTime
coroutine.yield(1)
end
end

Space.Host.StartCoroutine(co)

LocalTimeRead only​

string LocalTime {get; }

Returns current local time.

Example

Lua
localTime = Space.LocalTime
Lua
--this script will update a UIText object with the current local time
--(example: clock)
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

co = function()
while true do
text.Text = Space.LocalTime
coroutine.yield(1)
end
end

Space.Host.StartCoroutine(co)

LoginTimeRead only​

float LoginTime {get; }

Returns how long player has been logged in (in seconds).

Example

Lua
loginTime = Space.LoginTime
Lua
--this script will update a UIText object with how long the user has been logged in (in seconds)
--(example: clock)
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

co = function()
while true do
text.Text = Space.LoginTime
coroutine.yield(1)
end
end

Space.Host.StartCoroutine(co)

ServerTimeUnixRead only​

int ServerTimeUnix {get; }

Returns the server time unix timestamp.

Example

Lua
serverTimeUnix = Space.ServerTimeUnix
Lua
--this script will update a UIText object with the current server time unix timestamp
--(example: clock)
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

co = function()
while true do
text.Text = Space.ServerTimeUnix
coroutine.yield(1)
end
end

Space.Host.StartCoroutine(co)

LocalTimeUnixRead only​

int LocalTimeUnix {get; }

Returns the local time unix timestamp.

Example

Lua
localTimeUnix = Space.LocalTimeUnix
Lua
--this script will update a UIText object with the current local time unix timestamp
--(example: clock)
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

co = function()
while true do
text.Text = Space.LocalTimeUnix
coroutine.yield(1)
end
end

Space.Host.StartCoroutine(co)

DeltaTimeRead only​

float DeltaTime {get; }

The completion time in seconds since the last frame.

Example

Lua
deltaTime = Space.DeltaTime
Lua
--the below script rotates an object around Y axis but uses DeltaTime
--to make sure it's not dependant on client's Framerate (FPS)
--this way the object rotates per second not per frame
--(Example: Important movement in OnUpdate)

thisGameObject = Space.Host.ExecutingObject



OnUpdate = function()
currentY = thisGameObject.WorldRotation.EulerAngles.Y
newRotation = Quaternion.Euler(0, currentY + 1 * Space.DeltaTime, 0) --We multiplied 1 by Space.DeltaTime
thisGameObject.WorldRotation = newRotation
end

thisGameObject.OnUpdate(OnUpdate)

PreviewServerRead only​

bool PreviewServer {get; }

Return true if in preview server.

Example

Lua
isInPreview = Space.PreviewServer
Lua
--this script will update a UIText object with "preview" or "live" depending
--whether we are on preview server or live server
--[UIText object needs to be added to the references section in the scripting runtime with name "Text"]

text = Space.Host.GetReference("Text").UIText

OnUpdate = function()
if Space.PreviewServer then
text.Text = "Preview"
else
text.Text = "Live"
end
end

Space.Host.ExecutingObject.OnUpdate(OnUpdate)

ComponentNameRead only​

string ComponentName {get; }

The name of this component.

Example

Lua
componentName = Space.ComponentName