SScript
On this classTypeName
- Functions
- Type
Name - Tracking
Allowed - Tracking
Request - Get
Resource - Log
Event - Log
- Properties
- Inventory
- Persistence
- Scene
- Grid
- Host
- Physics
- Math
- String
- Input
- Camera
- Web
Services - Network
- PostFX
- Audio
Analyser - Tween
- UI
- Dialogues
- Shared
- Quests
- Economy
- Groups
- Activity
- Render
Settings - Profile
- Photos
- Videos
- Music
Directory - Journey
- Game
Tester - Runtime
Type - Platform
- SessionID
- In
Editor - Version
- Full
Version String - Resources
- Time
- Server
Time - Local
Time - Login
Time - Server
Time Unix - Local
Time Unix - Delta
Time - Preview
Server - Component
Name
| Function | TypeName | Return the type name of the value. |
| Function | TrackingAllowed | Returns true on white-label grids when the user has opted into tracking for the given key. |
| Function | TrackingRequest | Displays a consent prompt (EULA-style) asking the user to allow tracking for a given key. |
| Function | GetResource | Returns a reference to a SResource using it's Resource name. |
| Function | LogEvent | Logs an analytics event to the server on white-label grids. |
| Function | Log | Log a message to console. |
| Property | Inventory | Allows access to the users inventory |
| Property | Persistence | Stores information between user sessions, and for other users |
| Property | Scene | Allows access to the current scene graph (objects and avatars in the scene, and other information) |
| Property | Grid | – |
| Property | Host | Access information about the current scripting runtime host |
| Property | Physics | Call physics-related commands, and variables, such as raycasting |
| Property | Math | Math related functions (Sin, Cos, Tan, etc) |
| Property | String | Miscellaneous additional string functions (e.g. MD5Sum) |
| Property | Input | Input device related functions (mouse position, keyboard state) |
| Property | Camera | Take and control the users camera |
| Property | WebServices | Call remote web services to designated hosts (will not work with arbitrary domains, see page for details) |
| Property | Network | Send data to other clients through the region server |
| Property | PostFX | – |
| Property | AudioAnalyser | – |
| Property | Tween | – |
| Property | UI | – |
| Property | Dialogues | – |
| Property | Shared | – |
| Property | Quests | – |
| Property | Economy | – |
| Property | Groups | – |
| Property | Activity | – |
| Property | RenderSettings | – |
| Property | Profile | – |
| Property | Photos | – |
| Property | Videos | – |
| Property | MusicDirectory | – |
| Property | Journey | – |
| Property | GameTester | – |
| Property | RuntimeType | Return current RuntimeType name. |
| Property | Platform | Return current platform name. |
| Property | SessionID | Return current SessionID. |
| Property | InEditor | Return true if in unity editor. |
| Property | Version | Returns the numeric build version of the viewer (for programmatic comparisons). |
| Property | FullVersionString | Returns the full build version display string tied to release notes (e.g., "2025.6f210"). |
| Property | Resources | – |
| Property | Time | Returns time at the beginning of this frame. |
| Property | ServerTime | Returns current server time. |
| Property | LocalTime | Returns current local time. |
| Property | LoginTime | Returns how long player has been logged in (in seconds). |
| Property | ServerTimeUnix | Returns the server time unix timestamp. |
| Property | LocalTimeUnix | Returns the local time unix timestamp. |
| Property | DeltaTime | The completion time in seconds since the last frame. |
| Property | PreviewServer | Return true if in preview server. |
| Property | ComponentName | The name of this component. |
Functions
TypeName
Return the type name of the value.
Parameters
| Name | Type | Default |
|---|---|---|
| dv | DynValue | – |
Returns
string
Example
typeName = Space.TypeName("123")
TrackingAllowed
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
| Parameter | Type | Description |
|---|---|---|
| key | string | A unique identifier used to store and look up the user's tracking consent. |
Returns
bool
Example
isTrackingAllowed = Space.TrackingAllowed('3423423423423')
TrackingRequest
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
| Parameter | Type | Description |
|---|---|---|
| key | string | A unique identifier used to store and look up the user's tracking consent. |
| privacynotice | string | The privacy notice text to display in the consent dialog. |
| callback | Closure | A function invoked with one boolean parameter: true if allowed, false otherwise. |
| force | bool | If true, show the prompt even if a stored decision exists. Defaults to false. |
Returns
void
Example
-- 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
Returns a reference to a SResource using it's Resource name.
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | Name of the Resource as set in the Scripting Runtime Component (Resources section) |
Returns
SResource
Example
aResource = Space.GetResource("ResourceName")
LogEvent
Logs an analytics event to the server on white-label grids.
Parameters
| Parameter | Type | Description |
|---|---|---|
| eventName | string | The name of the analytics event. |
| value | float | A numeric value associated with the event. |
| position | SVector | A world position to associate with the event. |
Returns
void
Example
Space.LogEvent('event name', 2.0, Vector.New(0,0,0) )
Log
Log a message to console.
Parameters
| Name | Type | Default |
|---|---|---|
| text | DynValue | – |
| logToFile | bool | false |
| text | string | – |
Returns
void
Example
Space.Log(Color.Blue)
--or
Space.Log("Log")
--or
Space.Log("Log",true)
Properties
InventoryRead only
Allows access to the users inventory
Example
inventory = Space.Inventory
PersistenceRead only
Stores information between user sessions, and for other users
Example
``` persistence = Space.Persistence ```
SceneRead only
Allows access to the current scene graph (objects and avatars in the scene, and other information)
Example
scene = Space.Scene
GridRead only
Example
grid = Space.Grid
HostRead only
Access information about the current scripting runtime host
Example
host = Space.Host
PhysicsRead only
Call physics-related commands, and variables, such as raycasting
Example
physics = Space.Physics
MathRead only
Math related functions (Sin, Cos, Tan, etc)
Example
Space.Math.Ceil(4.0)
StringRead only
Miscellaneous additional string functions (e.g. MD5Sum)
Example
Space.String.GetBytes("some data")
InputRead only
Input device related functions (mouse position, keyboard state)
Example
Space.Input.Vibrate(1,1,false)
CameraRead only
Take and control the users camera
Example
obj = Space.Host.ExecutingObject
Space.Camera.LockCamera (obj)
WebServicesRead only
Call remote web services to designated hosts (will not work with arbitrary domains, see page for details)
Example
Space.WebServices.GetImage("example.com/mrlee.jpg")
NetworkRead only
Send data to other clients through the region server
Example
Space.Network.SubscribeToNetwork("helloworld", gotAMessageFunction)
PostFXRead only
Example
Space.PostFX
AudioAnalyserRead only
Example
Space.AudioAnalyser
TweenRead only
Example
Space.Tween
UIRead only
Example
ui = Space.UI
DialoguesRead only
Example
dialogues = Space.Dialogues
SharedRead only
Example
shared = Space.Shared
QuestsRead only
Example
quests = Space.Quests
EconomyRead only
Example
economy = Space.Economy
GroupsRead only
Example
groups = Space.Groups
ActivityRead only
Example
``` activity = Space.Activity ```
RenderSettingsRead only
Example
renderSettings = Space.RenderSettings
ProfileRead only
Example
profile = Space.Profile
PhotosRead only
Example
photos = Space.Photos
VideosRead only
Example
videos = Space.Videos
MusicDirectoryRead only
Example
musicDirectory = Space.MusicDirectory
JourneyRead only
Example
journey = Space.Journey
GameTesterRead only
Example
gameTester = Space.GameTester
RuntimeTypeRead only
Return current RuntimeType name.
Example
runtimeType = Space.RuntimeType
PlatformRead only
Return current platform name.
Example
platform = Space.Platform
SessionIDRead only
Return current SessionID.
Example
sessionID = Space.SessionID
InEditorRead only
Return true if in unity editor.
Example
isInEditor = Space.InEditor
--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
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
viewerVersion = Space.Version
FullVersionStringRead only
Returns the full build version display string tied to release notes (e.g., "2025.6f210"). Best for user-facing display and logging.
Example
viewerVersionString = Space.FullVersionString
ResourcesRead only
Example
tableOfResources = Space.Resources
--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
Returns time at the beginning of this frame.
Example
floatTime = Space.Time
--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
Returns current server time.
Example
serverTime = Space.ServerTime
--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
Returns current local time.
Example
localTime = Space.LocalTime
--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
Returns how long player has been logged in (in seconds).
Example
loginTime = Space.LoginTime
--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
Returns the server time unix timestamp.
Example
serverTimeUnix = Space.ServerTimeUnix
--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
Returns the local time unix timestamp.
Example
localTimeUnix = Space.LocalTimeUnix
--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
The completion time in seconds since the last frame.
Example
deltaTime = Space.DeltaTime
--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
Return true if in preview server.
Example
isInPreview = Space.PreviewServer
--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
The name of this component.
Example
componentName = Space.ComponentName



