Extend AgentScript to create a script to be attached directly to an agent. For future use: Sansar does not currently support adding scripts to agents.
public abstract class AgentScript : Sansar.Script.ScriptBaseRemarks
Override ScriptBase.Init for script initialization, primarily event subscriptions.
Use AgentScript.ObjectPrivate to access the ObjectPrivate the object that represents the Agent.
Use AgentScript.ScenePublic to access the a limited API for the Scene the agent is in.
Use AgentScript.AgentPrivate to access the Agent the object is attached to.
Members at a glance
| Kind | Members |
|---|---|
| Constructors | AgentScript |
| Properties | AgentPrivate · ObjectPrivate · ScenePublic |
Constructors
AgentScript
protected AgentScript()This constructor is called before any properties have been set. Override ScriptBase.Init to initialize the script after properties have been set.
Properties
AgentPrivate
[Sansar.Script.NonReflective]
public AgentPrivate AgentPrivate { protected get; set; }The Agent API for the agent this script is attached to.
Value: AgentPrivate — The Agent this script is attached to if the script is on an avatar, null otherwise.
Remarks
The Agent will be set before ScriptBase.Init is called.
ObjectPrivate
[Sansar.Script.NonReflective]
public ObjectPrivate ObjectPrivate { protected get; set; }The ObjectPrivate this script is attached to if it is attached to an object.
Value: ObjectPrivate — 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.
ScenePublic
[Sansar.Script.NonReflective]
public ScenePublic ScenePublic { protected get; set; }Basic scene information for the current scene.
Value: ScenePublic — The Scene this object is in.
Remarks
This value will be set before Init is called.
Used in examples
Generated from the Sansar 47.10.0 client ScriptApi snapshot.