SScript
Dans cette classeTypeName
- Fonctions
- Type
Name - Tracking
Allowed - Tracking
Request - Get
Resource - Log
Event - Log
- Propriétés
- 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
| Fonction | TypeName | Return the type name of the value. |
| Fonction | TrackingAllowed | Returns true on white-label grids when the user has opted into tracking for the given key. |
| Fonction | TrackingRequest | Displays a consent prompt (EULA-style) asking the user to allow tracking for a given key. |
| Fonction | GetResource | Returns a reference to a SResource using it's Resource name. |
| Fonction | LogEvent | Logs an analytics event to the server on white-label grids. |
| Fonction | Log | Log a message to console. |
| Propriété | Inventory | Allows access to the users inventory |
| Propriété | Persistence | Stores information between user sessions, and for other users |
| Propriété | Scene | Allows access to the current scene graph (objects and avatars in the scene, and other information) |
| Propriété | Grid | – |
| Propriété | Host | Access information about the current scripting runtime host |
| Propriété | Physics | Call physics-related commands, and variables, such as raycasting |
| Propriété | Math | Math related functions (Sin, Cos, Tan, etc) |
| Propriété | String | Miscellaneous additional string functions (e.g. MD5Sum) |
| Propriété | Input | Input device related functions (mouse position, keyboard state) |
| Propriété | Camera | Take and control the users camera |
| Propriété | WebServices | Call remote web services to designated hosts (will not work with arbitrary domains, see page for details) |
| Propriété | Network | Send data to other clients through the region server |
| Propriété | PostFX | – |
| Propriété | AudioAnalyser | – |
| Propriété | Tween | – |
| Propriété | UI | – |
| Propriété | Dialogues | – |
| Propriété | Shared | – |
| Propriété | Quests | – |
| Propriété | Economy | – |
| Propriété | Groups | – |
| Propriété | Activity | – |
| Propriété | RenderSettings | – |
| Propriété | Profile | – |
| Propriété | Photos | – |
| Propriété | Videos | – |
| Propriété | MusicDirectory | – |
| Propriété | Journey | – |
| Propriété | GameTester | – |
| Propriété | RuntimeType | Return current RuntimeType name. |
| Propriété | Platform | Return current platform name. |
| Propriété | SessionID | Return current SessionID. |
| Propriété | InEditor | Return true if in unity editor. |
| Propriété | Version | Returns the numeric build version of the viewer (for programmatic comparisons). |
| Propriété | FullVersionString | Returns the full build version display string tied to release notes (e.g., "2025.6f210"). |
| Propriété | Resources | – |
| Propriété | Time | Returns time at the beginning of this frame. |
| Propriété | ServerTime | Returns current server time. |
| Propriété | LocalTime | Returns current local time. |
| Propriété | LoginTime | Returns how long player has been logged in (in seconds). |
| Propriété | ServerTimeUnix | Returns the server time unix timestamp. |
| Propriété | LocalTimeUnix | Returns the local time unix timestamp. |
| Propriété | DeltaTime | The completion time in seconds since the last frame. |
| Propriété | PreviewServer | Return true if in preview server. |
| Propriété | ComponentName | The name of this component. |
Fonctions
TypeName
Return the type name of the value.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| dv | DynValue | – |
Valeurs de retour
string
Exemple
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.
Paramètres
| Paramètre | Type | Description |
|---|---|---|
| key | string | A unique identifier used to store and look up the user's tracking consent. |
Valeurs de retour
bool
Exemple
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.
Paramètres
| Paramètre | 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. |
Valeurs de retour
void
Exemple
-- 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.
Paramètres
| Paramètre | Type | Description |
|---|---|---|
| name | string | Name of the Resource as set in the Scripting Runtime Component (Resources section) |
Valeurs de retour
SResource
Exemple
aResource = Space.GetResource("ResourceName")
LogEvent
Logs an analytics event to the server on white-label grids.
Paramètres
| Paramètre | 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. |
Valeurs de retour
void
Exemple
Space.LogEvent('event name', 2.0, Vector.New(0,0,0) )
Log
Log a message to console.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| text | DynValue | – |
| logToFile | bool | false |
| text | string | – |
Valeurs de retour
void
Exemple
Space.Log(Color.Blue)
--or
Space.Log("Log")
--or
Space.Log("Log",true)
Propriétés
InventoryLecture seule
Allows access to the users inventory
Exemple
inventory = Space.Inventory
PersistenceLecture seule
Stores information between user sessions, and for other users
Exemple
``` persistence = Space.Persistence ```
SceneLecture seule
Allows access to the current scene graph (objects and avatars in the scene, and other information)
Exemple
scene = Space.Scene
GridLecture seule
Exemple
grid = Space.Grid
HostLecture seule
Access information about the current scripting runtime host
Exemple
host = Space.Host
PhysicsLecture seule
Call physics-related commands, and variables, such as raycasting
Exemple
physics = Space.Physics
MathLecture seule
Math related functions (Sin, Cos, Tan, etc)
Exemple
Space.Math.Ceil(4.0)
StringLecture seule
Miscellaneous additional string functions (e.g. MD5Sum)
Exemple
Space.String.GetBytes("some data")
InputLecture seule
Input device related functions (mouse position, keyboard state)
Exemple
Space.Input.Vibrate(1,1,false)
CameraLecture seule
Take and control the users camera
Exemple
obj = Space.Host.ExecutingObject
Space.Camera.LockCamera (obj)
WebServicesLecture seule
Call remote web services to designated hosts (will not work with arbitrary domains, see page for details)
Exemple
Space.WebServices.GetImage("example.com/mrlee.jpg")
NetworkLecture seule
Send data to other clients through the region server
Exemple
Space.Network.SubscribeToNetwork("helloworld", gotAMessageFunction)
PostFXLecture seule
Exemple
Space.PostFX
AudioAnalyserLecture seule
Exemple
Space.AudioAnalyser
TweenLecture seule
Exemple
Space.Tween
UILecture seule
Exemple
ui = Space.UI
DialoguesLecture seule
Exemple
dialogues = Space.Dialogues
SharedLecture seule
Exemple
shared = Space.Shared
QuestsLecture seule
Exemple
quests = Space.Quests
EconomyLecture seule
Exemple
economy = Space.Economy
GroupsLecture seule
Exemple
groups = Space.Groups
ActivityLecture seule
Exemple
``` activity = Space.Activity ```
RenderSettingsLecture seule
Exemple
renderSettings = Space.RenderSettings
ProfileLecture seule
Exemple
profile = Space.Profile
PhotosLecture seule
Exemple
photos = Space.Photos
VideosLecture seule
Exemple
videos = Space.Videos
MusicDirectoryLecture seule
Exemple
musicDirectory = Space.MusicDirectory
JourneyLecture seule
Exemple
journey = Space.Journey
GameTesterLecture seule
Exemple
gameTester = Space.GameTester
RuntimeTypeLecture seule
Return current RuntimeType name.
Exemple
runtimeType = Space.RuntimeType
PlatformLecture seule
Return current platform name.
Exemple
platform = Space.Platform
SessionIDLecture seule
Return current SessionID.
Exemple
sessionID = Space.SessionID
InEditorLecture seule
Return true if in unity editor.
Exemple
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)
VersionLecture seule
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.
Exemple
viewerVersion = Space.Version
FullVersionStringLecture seule
Returns the full build version display string tied to release notes (e.g., "2025.6f210"). Best for user-facing display and logging.
Exemple
viewerVersionString = Space.FullVersionString
ResourcesLecture seule
Exemple
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
TimeLecture seule
Returns time at the beginning of this frame.
Exemple
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)
ServerTimeLecture seule
Returns current server time.
Exemple
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)
LocalTimeLecture seule
Returns current local time.
Exemple
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)
LoginTimeLecture seule
Returns how long player has been logged in (in seconds).
Exemple
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)
ServerTimeUnixLecture seule
Returns the server time unix timestamp.
Exemple
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)
LocalTimeUnixLecture seule
Returns the local time unix timestamp.
Exemple
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)
DeltaTimeLecture seule
The completion time in seconds since the last frame.
Exemple
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)
PreviewServerLecture seule
Return true if in preview server.
Exemple
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)
ComponentNameLecture seule
The name of this component.
Exemple
componentName = Space.ComponentName



