SimpleScript

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]
public abstract class SimpleScript : Sansar.Script.ScriptBase

Remarks

Use SimpleScript.ObjectPrivate to access the Object the script is on.

Use SimpleScript.ScenePrivate to access the Scene the object is in.

Override SimpleScript.OnAddUser(AgentPrivate) to handle AddUser events.

C# Example
            protected override OnAddUser(AgentPrivate agent)
            {
                agent.SendChat($"Welcome to the {ScenePrivate.SceneInfo.ExperienceName} scene!");
            }

Override SimpleScript.OnRemoveUser(AgentInfo) to handle AddUser events.

C# Example
            protected override OnRemoveUser(AgentInfo agent)
            {
                Log.Write($"{agent.Name} has left the region.");
            }

Override SimpleScript.OnTimer to do something at regular intervals.

C# Example
            protected override OnTimer()
            {
                RigidBodyComponent?.SetPosition(ObjectPrivate?.InitialPosition);
            }

Override SimpleScript.OnChat(ChatData) to handle Chat events when users or scripts chat.

C# Example
            protected override OnChat(ChatData data)
            {
                AgentPrivate agent = ScenePrivate.FindAgent(data.SourceId);
                if (agent != null && agent.AgentInfo.AvatarUuid == ScenePrivate.SceneInfo.AvatarUuid))
                {
                   Log.Write($"Scene owner {agent.AgentInfo.Name} said {data.Message}");
                }
            }

Override SimpleScript.OnCollision(CollisionData) to handle Collision events with the object this script is on.

C# Example
            protected override OnCollision(CollisionData data)
            {
                Log.Write($"Bumped {data.HitObject.ObjectId}");
            }

Override SimpleScript.OnScriptEvent(Sansar.Script.ScriptId, object) to handle ScriptEvent events from other scripts.

C# Example
            protected override OnScriptEvent(AgentPrivate agent)
            {
                ISimpleScriptEvent simple = data.Data.As<ISimpleScriptEvent>();
                Log.Write($"Received message {data.Message} event with data {simple.Value}");
            }

Override Sansar.Script.SimpleScript.SimpleInit() for more advanced script initialization.

C# Example
/* This content is licensed under the terms of the Creative Commons Attribution 4.0 International License.
 * When using this content, you must:
 * �    Acknowledge that the content is from the Sansar Knowledge Base.
 * �    Include our copyright notice: "� 2017 Linden Research, Inc."
 * �    Indicate that the content is licensed under the Creative Commons Attribution-Share Alike 4.0 International License.
 * �    Include the URL for, or link to, the license summary at https://creativecommons.org/licenses/by-sa/4.0/deed.hi (and, if possible, to the complete license terms at https://creativecommons.org/licenses/by-sa/4.0/legalcode.
 * For example:
 * "This work uses content from the Sansar Knowledge Base. � 2017 Linden Research, Inc. Licensed under the Creative Commons Attribution 4.0 International License (license summary available at https://creativecommons.org/licenses/by/4.0/ and complete license terms available at https://creativecommons.org/licenses/by/4.0/legalcode)."
 */

/* Track visitors to the scene with the AddUser and RemoveUser events.
 */
using System;
using Sansar.Script;
using Sansar.Simulation;
using System.Collections.Generic;

public class SimpleExample : SimpleScript
{
    protected override void SimpleInit()
    {
        
    }

    // This event occurs when a user enters the scene
    protected override void OnAddUser(AgentPrivate agent)
    {
        agent.SendChat($"Welcome to the {ScenePrivate.SceneInfo.ExperienceName} scene!");
    }

    // This event occurs when a user leaves the scene
    protected override void OnRemoveUser(AgentInfo info)
    {
        Log.Write($"{info.Name} has left the region.");
    }

    // This event occurs every Rate seconds: in this case every 0.2 seconds.
    [OnTimerOptions(Rate = 0.2)]
    protected override void OnTimer()
    {
        RigidBodyComponent?.SetPosition(ObjectPrivate.InitialPosition);
    }

    // This event occurs whenever anything sends chat on default channel
    // Use [OnChatOptions] to listen for chat on other channels.
    protected override void OnChat(ChatData data)
    {
        AgentPrivate agent = ScenePrivate.FindAgent(data.SourceId);
        if (agent != null && agent.AgentInfo.AvatarUuid == ScenePrivate.SceneInfo.AvatarUuid)
        {
            Log.Write($"Scene owner {agent.AgentInfo.Name} said {data.Message}");
        }
    }

    // This event occurs whenever the object it is on collides with a character
    [OnCollisionOptions(EventType = CollisionEventType.CharacterContact)]
    protected override void OnCollision(CollisionData data)
    {
        Log.Write($"Bumped {data.HitObject.ObjectId}");
    }

    // If Message were not set then OnScriptEvent would receive script events for the name of the class: in this case "SimpleExample"
    [OnScriptEventOptions(Message ="SimpleEvent")]
    protected override void OnScriptEvent(ScriptId id, object data)
    {
        Log.Write($"Received scriptevent with data {data}");
    }
}

Requirements

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

Members

See Also: Inherited members from Sansar.Script.ScriptBase.

Protected Constructors

 
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.

Public Properties

 
Log Sansar.Script.Log . Gets the script console. (Inherited from Sansar.Script.ScriptBase.)
 
Memory Sansar.Script.Memory . Memory information for the pool this script is in. (Inherited from Sansar.Script.ScriptBase.)
 
ObjectPrivate ObjectPrivate . The ObjectPrivate this script is attached to if it is attached to an object.
 
ScenePrivate ScenePrivate . The Scene API for the Scene this script is a part of if the script is attached to scene content.
 
Script Sansar.Script.ScriptHandle . Script handle to this script. (Inherited from Sansar.Script.ScriptBase.)

Protected Properties

[read-only]
 
PendingEventCount int . The number of events currently waiting to be processed. (Inherited from Sansar.Script.ScriptBase.)
[read-only]
 
RigidBodyComponent RigidBodyComponent . The first RigidBodyComponent on ObjectPrivate

Public Methods

 
AsInterface<TInterface> () : TInterface
Returns a TInterface object if one can be created, null otherwise (Inherited from Sansar.Script.Reflective.)
 
FullInterface (string) : string
Generates a string which shows all the members which can be reflected. (Inherited from Sansar.Script.Reflective.)
override
Init ()
Init() initializes all event subscriptions for the overridable methods in SimpleScript
abstract
Init ()
Init() is called after all interfaces have been initialized. (Inherited from Sansar.Script.ScriptBase.)
 
Register ()
Register this object to be found with ScenePrivate.FindReflective(string) (Inherited from Sansar.Script.Reflective.)
 
Unregister ()
Unregister this object so it will not be found with ScenePrivate.FindReflective(string) (Inherited from Sansar.Script.Reflective.)
 
Yield ()
Yield to let other coroutines or events run. (Inherited from Sansar.Script.ScriptBase.)

Protected Methods

 
GetSubscription (string) : Sansar.Script.IEventSubscription
Get the IEventSubscription for any of the registered event subscription methods
 
OnAddUser (AgentPrivate)
Code in OnAddUser will run whenever a user enters the scene.
 
OnChat (ChatData)
Code in OnChat will run whenever chat is heard.
 
OnCollision (CollisionData)
Receive events whenever the object this script is on collides with something or someone.
 
OnRemoveUser (AgentInfo)
Code in OnRemoveUser will run whenever a user leaves the scene.
 
OnScriptEvent (Sansar.Script.ScriptId, object)
Receive events from other scripts.
 
OnTimer ()
Code in OnTimer will run at regular intervals.
 
PostScriptEvent (string)
Post the event for all scripts. (Inherited from Sansar.Script.ScriptBase.)
 
PostScriptEvent (string, Sansar.Script.Reflective)
Post the event for all scripts. (Inherited from Sansar.Script.ScriptBase.)
 
PostScriptEvent (Sansar.Script.ScriptId, string, Sansar.Script.Reflective)
Post the event for the target script. (Inherited from Sansar.Script.ScriptBase.)
 
PostSimpleScriptEvent (string, object)
Post the simple event for all scripts. (Inherited from Sansar.Script.ScriptBase.)
 
PostSimpleScriptEvent (Sansar.Script.ScriptId, string, object)
Post the simple script event for the target script. (Inherited from Sansar.Script.ScriptBase.)
 
SimpleInit ()
Override SimpleInit for script setup, such as subscribing to other events or
 
StartCoroutine (Action)
Starts a coroutine on the current script. (Inherited from Sansar.Script.ScriptBase.)
 
StartCoroutine<T> (Action<T>, T)
Starts a coroutine on the current script. (Inherited from Sansar.Script.ScriptBase.)
 
StartCoroutine<T,T1> (Action<T, T1>, T, T1)
Starts a coroutine on the current script. (Inherited from Sansar.Script.ScriptBase.)
 
StartCoroutine<T,T1,T2> (Action<T, T1, T2>, T, T1, T2)
Starts a coroutine on the current script. (Inherited from Sansar.Script.ScriptBase.)
 
StartCoroutine<T,T1,T2,T3> (Action<T, T1, T2, T3>, T, T1, T2, T3)
Starts a coroutine on the current script. (Inherited from Sansar.Script.ScriptBase.)
 
SubscribeToScriptEvent (string, Action<Sansar.Script.ScriptEventData>, bool) : Sansar.Script.IEventSubscription
Subscribes to events sent by other scripts (Inherited from Sansar.Script.ScriptBase.)
 
SubscribeToScriptEvent (Sansar.Script.ScriptId, string, Action<Sansar.Script.ScriptEventData>, bool) : Sansar.Script.IEventSubscription
Subscribes to events sent only by a specific script. (Inherited from Sansar.Script.ScriptBase.)
 
Terminate (string)
Terminates this script immediately. (Inherited from Sansar.Script.ScriptBase.)
 
Wait (TimeSpan)
Delays execution of the current coroutine for the specified time. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor (Func<Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor (Func<Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor (Func<Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1> (Func<ARG1, Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1> (Func<ARG1, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1> (Func<ARG1, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<T1> (Func<T1, Action<Sansar.Script.OperationCompleteEvent>,System.UInt64>, T1) : Sansar.Script.OperationCompleteEvent
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2> (Func<ARG1, ARG2, Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2> (Func<ARG1, ARG2, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2> (Func<ARG1, ARG2, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<T1,T2> (Func<T1, T2, Action<Sansar.Script.OperationCompleteEvent>,System.UInt64>, T1, T2) : Sansar.Script.OperationCompleteEvent
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3> (Func<ARG1, ARG2, ARG3, Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3> (Func<ARG1, ARG2, ARG3, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3> (Func<ARG1, ARG2, ARG3, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<T1,T2,T3> (Func<T1, T2, T3, Action<Sansar.Script.OperationCompleteEvent>,System.UInt64>, T1, T2, T3) : Sansar.Script.OperationCompleteEvent
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4> (Func<ARG1, ARG2, ARG3, ARG4, Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4> (Func<ARG1, ARG2, ARG3, ARG4, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4> (Func<ARG1, ARG2, ARG3, ARG4, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<T1,T2,T3,T4> (Func<T1, T2, T3, T4, Action<Sansar.Script.OperationCompleteEvent>,System.UInt64>, T1, T2, T3, T4) : Sansar.Script.OperationCompleteEvent
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4,ARG5> (Func<ARG1, ARG2, ARG3, ARG4, ARG5, Action<Sansar.Script.EventData>, Action<Sansar.Script.CancelData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4, ARG5) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4,ARG5> (Func<ARG1, ARG2, ARG3, ARG4, ARG5, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4, ARG5) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)
 
WaitFor<ARG1,ARG2,ARG3,ARG4,ARG5> (Func<ARG1, ARG2, ARG3, ARG4, ARG5, Action<Sansar.Script.EventData>,System.Boolean,Sansar.Script.IEventSubscription>, ARG1, ARG2, ARG3, ARG4, ARG5, Action) : Sansar.Script.EventData
Use in a coroutine to pause the script until an event happens. (Inherited from Sansar.Script.ScriptBase.)

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]
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

protected Sansar.Script.IEventSubscription GetSubscription (string methodName)

Parameters

methodName
The n

Returns

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

Remarks

Documentation for this section has not yet been entered.

Example

C# Example
            GetSubscription("OnChat").Unsubscribe();
            

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 void 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 ObjectPrivate ObjectPrivate { protected get; set; }

Value

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

Remarks

For AgentScripts this is the Agent's ObjectPrivate of their avatar.

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]
protected virtual void OnAddUser (AgentPrivate agent)

See Also

Parameters

agent
The AgentPrivate for the user that has joined the scene.

Remarks

Override OnAddUser to handle events when a user enters the scene.

Example

C# Example
            protected override OnAddUser(AgentPrivate agent)
            {
               agent.SendChat($"Welcome to the {ScenePrivate.SceneInfo.ExperienceName} scene!");
            }
            

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]
protected virtual void OnChat (ChatData data)

See Also

Parameters

data
ChatData for the message.

Remarks

Defaults to all chat on the default channel. Use [OnChatOptions] to change the channel or limit the source of the chat.

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]
protected virtual void OnCollision (CollisionData data)

See Also

Parameters

data
The CollisionData about the collision.

Remarks

By default receives events for every collision. Use Sansar.Simulation.SimpleScript.OnCollisionOptionsAttribute to change which types of collision events will trigger OnCollision.

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]
protected virtual void OnRemoveUser (AgentInfo data)

See Also

Parameters

data
UserData for the user that has left the scene.

Remarks

Override OnAddUser to handle events when a user enters the scene.

Example

C# Example
// This event occurs when a user leaves the scene
            protected override void OnRemoveUser(AgentInfo info)
            {
                Log.Write($"{info.Name} has left the region.");
            }

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]
protected virtual void OnScriptEvent (Sansar.Script.ScriptId sourceScriptId, object 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

If EventName is not set then OnScriptEvent will receive events with the name of the script class. In the following example it will receive events named "MySimpleScript"
C# Example
            public class SimpleExample : SimpleScript
            {
                // Send events to this handler from other simple scripts with: PostScriptEvent("SimpleExample", myVector);
                protected override void OnScriptEvent(object eventData)
                {
                    Vector newPos = eventData as Vector;
                    if (newPos != null) AllPositions.Add(newPos);
                }
            }    
            

To send events to a SimpleScript from a non-simple script, the non-simple script must build a Reflective class that contains a single public object field named Data like this:

C# Example
            class SimpleData : Reflective
            {
                public object Data;
            }
            

Then send the data like this:

C# Example
PostScriptEvent("simpleeventname",new SimpleData {Data = position});

Example

C# Example
            // Send events to this handler from other simple scripts with: PostScriptEvent("AddPosition", myVector);
            [OnScriptEventOptions(EventName="AddPosition")]
            protected override void OnScriptEvent(object eventData)
            {
                Vector newPos = eventData as Vector;
                if (newPos != null) AllPositions.Add(newPos);
            }
            

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]
protected virtual void OnTimer ()

Remarks

Defaults to one call per second. Change the rate with Sansar.Simulation.SimpleScript.OnTimerOptionsAttribute

Example

C# Example
            // Set OnTimer to happen once every minute.
            [OnTimerOptions(Rate=60)]
            protected override void OnTimer()
            

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 RigidBodyComponent RigidBodyComponent { get; }

Value

The first SimpleScript.RigidBodyComponent on the object this script is attached to.

Remarks

This is a convenience for:
C# Example
            RigidBodyComponent rigidbody;
             if (ObjectPrivate != null && ObjectPrivate.TryGetFirstComponent(out rigidbody))
            {
                // Do something with rigidbody
            }
            

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 ScenePrivate ScenePrivate { protected get; set; }

Value

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

Remarks

This value will be set before Init is called.

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]
protected virtual void SimpleInit ()

Remarks

SimpleInit is run after events have been set up for overridden methods. Use it to set up more complex subscriptions or otherwise initialize the script.

Requirements

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


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.