SScript
في هذا الصنفTypeName
- الدوال
- Type
Name - Tracking
Allowed - Tracking
Request - Get
Resource - Log
Event - Log
- الخصائص
- 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
| دالة | TypeName | Return the type name of the value. |
| دالة | TrackingAllowed | Returns true on white-label grids when the user has opted into tracking for the given key. |
| دالة | TrackingRequest | Displays a consent prompt (EULA-style) asking the user to allow tracking for a given key. |
| دالة | GetResource | Returns a reference to a SResource using it's Resource name. |
| دالة | LogEvent | Logs an analytics event to the server on white-label grids. |
| دالة | Log | Log a message to console. |
| خاصية | Inventory | Allows access to the users inventory |
| خاصية | Persistence | Stores information between user sessions, and for other users |
| خاصية | Scene | Allows access to the current scene graph (objects and avatars in the scene, and other information) |
| خاصية | Grid | – |
| خاصية | Host | Access information about the current scripting runtime host |
| خاصية | Physics | Call physics-related commands, and variables, such as raycasting |
| خاصية | Math | Math related functions (Sin, Cos, Tan, etc) |
| خاصية | String | Miscellaneous additional string functions (e.g. MD5Sum) |
| خاصية | Input | Input device related functions (mouse position, keyboard state) |
| خاصية | Camera | Take and control the users camera |
| خاصية | WebServices | Call remote web services to designated hosts (will not work with arbitrary domains, see page for details) |
| خاصية | Network | Send data to other clients through the region server |
| خاصية | PostFX | – |
| خاصية | AudioAnalyser | – |
| خاصية | Tween | – |
| خاصية | UI | – |
| خاصية | Dialogues | – |
| خاصية | Shared | – |
| خاصية | Quests | – |
| خاصية | Economy | – |
| خاصية | Groups | – |
| خاصية | Activity | – |
| خاصية | RenderSettings | – |
| خاصية | Profile | – |
| خاصية | Photos | – |
| خاصية | Videos | – |
| خاصية | MusicDirectory | – |
| خاصية | Journey | – |
| خاصية | GameTester | – |
| خاصية | RuntimeType | Return current RuntimeType name. |
| خاصية | Platform | Return current platform name. |
| خاصية | SessionID | Return current SessionID. |
| خاصية | InEditor | Return true if in unity editor. |
| خاصية | Version | Returns the numeric build version of the viewer (for programmatic comparisons). |
| خاصية | FullVersionString | Returns the full build version display string tied to release notes (e.g., "2025.6f210"). |
| خاصية | Resources | – |
| خاصية | Time | Returns time at the beginning of this frame. |
| خاصية | ServerTime | Returns current server time. |
| خاصية | LocalTime | Returns current local time. |
| خاصية | LoginTime | Returns how long player has been logged in (in seconds). |
| خاصية | ServerTimeUnix | Returns the server time unix timestamp. |
| خاصية | LocalTimeUnix | Returns the local time unix timestamp. |
| خاصية | DeltaTime | The completion time in seconds since the last frame. |
| خاصية | PreviewServer | Return true if in preview server. |
| خاصية | ComponentName | The name of this component. |
الدوال
TypeName
Return the type name of the value.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| dv | DynValue | – |
القيم المرجعة
string
مثال
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.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| key | string | A unique identifier used to store and look up the user's tracking consent. |
القيم المرجعة
bool
مثال
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.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| 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. |
القيم المرجعة
void
مثال
-- 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.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| name | string | Name of the Resource as set in the Scripting Runtime Component (Resources section) |
القيم المرجعة
SResource
مثال
aResource = Space.GetResource("ResourceName")
LogEvent
Logs an analytics event to the server on white-label grids.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| 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. |
القيم المرجعة
void
مثال
Space.LogEvent('event name', 2.0, Vector.New(0,0,0) )
Log
Log a message to console.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| text | DynValue | – |
| logToFile | bool | false |
| text | string | – |
القيم المرجعة
void
مثال
Space.Log(Color.Blue)
--or
Space.Log("Log")
--or
Space.Log("Log",true)
الخصائص
Inventoryللقراءة فقط
Allows access to the users inventory
مثال
inventory = Space.Inventory
Persistenceللقراءة فقط
Stores information between user sessions, and for other users
مثال
``` persistence = Space.Persistence ```
Sceneللقراءة فقط
Allows access to the current scene graph (objects and avatars in the scene, and other information)
مثال
scene = Space.Scene
Gridللقراءة فقط
مثال
grid = Space.Grid
Hostللقراءة فقط
Access information about the current scripting runtime host
مثال
host = Space.Host
Physicsللقراءة فقط
Call physics-related commands, and variables, such as raycasting
مثال
physics = Space.Physics
Mathللقراءة فقط
Math related functions (Sin, Cos, Tan, etc)
مثال
Space.Math.Ceil(4.0)
Stringللقراءة فقط
Miscellaneous additional string functions (e.g. MD5Sum)
مثال
Space.String.GetBytes("some data")
Inputللقراءة فقط
Input device related functions (mouse position, keyboard state)
مثال
Space.Input.Vibrate(1,1,false)
Cameraللقراءة فقط
Take and control the users camera
مثال
obj = Space.Host.ExecutingObject
Space.Camera.LockCamera (obj)
WebServicesللقراءة فقط
Call remote web services to designated hosts (will not work with arbitrary domains, see page for details)
مثال
Space.WebServices.GetImage("example.com/mrlee.jpg")
Networkللقراءة فقط
Send data to other clients through the region server
مثال
Space.Network.SubscribeToNetwork("helloworld", gotAMessageFunction)
PostFXللقراءة فقط
مثال
Space.PostFX
AudioAnalyserللقراءة فقط
مثال
Space.AudioAnalyser
Tweenللقراءة فقط
مثال
Space.Tween
UIللقراءة فقط
مثال
ui = Space.UI
Dialoguesللقراءة فقط
مثال
dialogues = Space.Dialogues
Sharedللقراءة فقط
مثال
shared = Space.Shared
Questsللقراءة فقط
مثال
quests = Space.Quests
Economyللقراءة فقط
مثال
economy = Space.Economy
Groupsللقراءة فقط
مثال
groups = Space.Groups
Activityللقراءة فقط
مثال
``` activity = Space.Activity ```
RenderSettingsللقراءة فقط
مثال
renderSettings = Space.RenderSettings
Profileللقراءة فقط
مثال
profile = Space.Profile
Photosللقراءة فقط
مثال
photos = Space.Photos
Videosللقراءة فقط
مثال
videos = Space.Videos
MusicDirectoryللقراءة فقط
مثال
musicDirectory = Space.MusicDirectory
Journeyللقراءة فقط
مثال
journey = Space.Journey
GameTesterللقراءة فقط
مثال
gameTester = Space.GameTester
RuntimeTypeللقراءة فقط
Return current RuntimeType name.
مثال
runtimeType = Space.RuntimeType
Platformللقراءة فقط
Return current platform name.
مثال
platform = Space.Platform
SessionIDللقراءة فقط
Return current SessionID.
مثال
sessionID = Space.SessionID
InEditorللقراءة فقط
Return true if in unity editor.
مثال
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)
Versionللقراءة فقط
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.
مثال
viewerVersion = Space.Version
FullVersionStringللقراءة فقط
Returns the full build version display string tied to release notes (e.g., "2025.6f210"). Best for user-facing display and logging.
مثال
viewerVersionString = Space.FullVersionString
Resourcesللقراءة فقط
مثال
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
Timeللقراءة فقط
Returns time at the beginning of this frame.
مثال
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)
ServerTimeللقراءة فقط
Returns current server time.
مثال
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)
LocalTimeللقراءة فقط
Returns current local time.
مثال
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)
LoginTimeللقراءة فقط
Returns how long player has been logged in (in seconds).
مثال
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)
ServerTimeUnixللقراءة فقط
Returns the server time unix timestamp.
مثال
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)
LocalTimeUnixللقراءة فقط
Returns the local time unix timestamp.
مثال
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)
DeltaTimeللقراءة فقط
The completion time in seconds since the last frame.
مثال
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)
PreviewServerللقراءة فقط
Return true if in preview server.
مثال
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)
ComponentNameللقراءة فقط
The name of this component.
مثال
componentName = Space.ComponentName



