Simple Script
Last updated
Last updated
Extend SimpleScript to create a script that can be used on content that is natively in the scene. This is the primary script type in Sansar.
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", true)] public abstract class SimpleScript :
This constructor is called before any properties have been set. Override Sansar.Script.SimpleScript.SimpleInit() to initialize the script after properties have been set and events setup.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected SimpleScript ()
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Get the IEventSubscription for any of the registered event subscription methods
SyntaxParameters
methodName
The n
Returns
An IEventSubscription interface that can be used to unsubscribe from a registered event.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Init() initializes all event subscriptions for the overridable methods in SimpleScript
SyntaxSee Also
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
The ObjectPrivate this script is attached to if it is attached to an object.
SyntaxValue
The scene object this script is attached to if it is attached to an object, null otherwise.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Code in OnAddUser will run whenever a user enters the scene.
SyntaxSee Also
Parameters
agent
The AgentPrivate for the user that has joined the scene.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Code in OnChat will run whenever chat is heard.
SyntaxSee Also
Parameters
data
ChatData for the message.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Receive events whenever the object this script is on collides with something or someone.
SyntaxSee Also
Parameters
data
The CollisionData about the collision.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Code in OnRemoveUser will run whenever a user leaves the scene.
SyntaxSee Also
Parameters
data
UserData for the user that has left the scene.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Receive events from other scripts.
SyntaxSee Also
Parameters
sourceScriptId
data
The data sent by another script, as an object.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Code in OnTimer will run at regular intervals.
Syntax
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
The first RigidBodyComponent on ObjectPrivate
SyntaxValue
RemarksThis is a convenience for:
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
The Scene API for the Scene this script is a part of if the script is attached to scene content.
SyntaxValue
The Scene API for this scene if this script was attached to scene content, null otherwise.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Override SimpleInit for script setup, such as subscribing to other events or
Syntax
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
[Sansar.Script.Api] public override sealed Init ()
[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ObjectPrivate { protected get; set; }
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnAddUser ( agent)
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnChat ( data)
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnCollision ( data)
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnRemoveUser ( data)
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnScriptEvent ( sourceScriptId, data)
The of the script that sent the message
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual OnTimer ()
[get: Sansar.Script.Interface] protected RigidBodyComponent { get; }
The first on the object this script is attached to.
[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ScenePrivate { protected get; set; }
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual SimpleInit ()