Simple Script

SimpleScript Class

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.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", true)] public abstract class SimpleScript : Sansar.Script.ScriptBasearrow-up-right

Member Details

SimpleScript Constructor

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

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


GetSubscription Method

Get the IEventSubscription for any of the registered event subscription methods

Syntax

Parameters

methodName

The n

Returns

An IEventSubscription interface that can be used to unsubscribe from a registered event.

Remarks

Example

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


Init Method

Init() initializes all event subscriptions for the overridable methods in SimpleScript

Syntax

[Sansar.Script.Api] public override sealed voidarrow-up-right Init ()

See Also

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


ObjectPrivate Property

The ObjectPrivate this script is attached to if it is attached to an object.

Syntax

[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ObjectPrivatearrow-up-right ObjectPrivate { protected get; set; }

Value

The scene object this script is attached to if it is attached to an object, null otherwise.

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnAddUser Method

Code in OnAddUser will run whenever a user enters the scene.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnAddUser (AgentPrivatearrow-up-right agent)

See Also

Parameters

agent

The AgentPrivate for the user that has joined the scene.

Remarks

Example

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnChat Method

Code in OnChat will run whenever chat is heard.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnChat (ChatDataarrow-up-right data)

See Also

Parameters

data

ChatData for the message.

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnCollision Method

Receive events whenever the object this script is on collides with something or someone.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnCollision (CollisionDataarrow-up-right data)

See Also

Parameters

data

The CollisionData about the collision.

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnRemoveUser Method

Code in OnRemoveUser will run whenever a user leaves the scene.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnRemoveUser (AgentInfoarrow-up-right data)

See Also

Parameters

data

UserData for the user that has left the scene.

Remarks

Example

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnScriptEvent Method

Receive events from other scripts.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnScriptEvent (Sansar.Script.ScriptId sourceScriptId, objectarrow-up-right data)

See Also

Parameters

sourceScriptId

The Sansar.Script.ScriptId of the script that sent the message

data

The data sent by another script, as an object.

Remarks

Example

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


OnTimer Method

Code in OnTimer will run at regular intervals.

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right OnTimer ()

Remarks

Example

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


RigidBodyComponent Property

The first RigidBodyComponent on ObjectPrivate

Syntax

[get: Sansar.Script.Interface] protected RigidBodyComponentarrow-up-right RigidBodyComponent { get; }

Value

The first SimpleScript.RigidBodyComponentarrow-up-right on the object this script is attached to.

Remarks

This is a convenience for:

C# Example

|

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


ScenePrivate Property

The Scene API for the Scene this script is a part of if the script is attached to scene content.

Syntax

[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ScenePrivatearrow-up-right ScenePrivate { protected get; set; }

Value

The Scene API for this scene if this script was attached to scene content, null otherwise.

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0


SimpleInit Method

Override SimpleInit for script setup, such as subscribing to other events or

Syntax

[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual voidarrow-up-right SimpleInit ()

Remarks

Requirements

Namespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0



Last updated