Skip to content

Get Sansar

Script API

ScenePublic

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

The Public Scene API, a more limited subset of ScenePrivate.

public class ScenePublic : Sansar.Script.InstanceInterface

Members at a glance

KindMembers
PropertiesAgentCount · Chat · SceneInfo · User
MethodsFindAgent · FindObject · FindReflective · GetAgent · GetAgents · GetPortalCreatorName · GetPortalDescription · GetPortalUri · ToString

Properties

AgentCount

public uint AgentCount { get; }

The number of agents in the Scene.

Value: uint — Unsigned integer count of the number of agents in the Scene.

Remarks

This number changes when agents join and part.

Chat

public Chat Chat { get; }

Gets the Chat interface for this Scene

Value: Chat — The Chat Api

SceneInfo

public SceneInfo SceneInfo { get; }

Gets the SceneInfo for this Scene

Value: SceneInfo — The full SceneInfo Api

User

public User User { get; }

Gets the User interface for this Scene

Value: User — The User Api

Methods

FindAgent

public AgentPublic FindAgent(Sansar.Script.ObjectId objectId)

Looks up an AgentInfo associated with the given object id.

ParameterTypeDescription
objectIdSansar.Script.ObjectIdThe object to find.

Returns: AgentPublic — The AgentInfo, or null if an agent cannot be found with that id.

Remarks

Agents may leave at any time. Attempting to use an Agent or AgentInfo interface for an agent no longer in the scene will throw a NullReferenceException.

public AgentPublic FindAgent(Sansar.Script.SessionId sessionId)

Looks up an AgentInfo associated with the given session id, if they are in the scene.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe sessionId of the agent to find.

Returns: AgentPublic — The AgentInfo, or null if an agent cannot be found with that id.

Remarks

Agents may leave at any time. Attempting to use an Agent or AgentInfo interface for an agent no longer in the scene will throw a NullReferenceException.

public AgentPublic FindAgent(Guid personaId)

Looks up an AgentInfo associated with the given persona id, if they are in the scene.

ParameterTypeDescription
personaIdGuidThe personaId of the agent to find.

Returns: AgentPublic — The agent, or null if an agent cannot be found with that id in the scene.

Remarks

Agents may leave at any time. Attempting to use an Agent or AgentInfo interface for an agent no longer in the scene will throw a NullReferenceException.

FindObject

Added in 32.0.0
public ObjectPublic FindObject(Sansar.Script.ObjectId objectId)

Looks up a Object associated with the given object id.

ParameterTypeDescription
objectIdSansar.Script.ObjectIdThe object to find.

Returns: ObjectPublic — The ObjectPublic, or null if a Object cannot be found with that id.

FindReflective

[Sansar.Script.NonReflective] public IEnumerable<TInterface> FindReflective<TInterface>(     string name ) where TInterface : class

Looks up Reflective objects in the scene that match the interface type by class name.

ParameterTypeDescription
namestringThe type name of the object’s class to find.

Type parameters: TInterface: The interface type to find.

Returns: IEnumerable<TInterface> — An IEnumerable which contains all objects of the given type name that match the given interface.

Remarks

The name given corresponds to the Type.FullName of the object. Multiple scripts may define unrelated types of the same name, but only registered objects that match the interface of TInterface will be returned.

GetAgent

public AgentPublic GetAgent(uint index)

Get an AgentPublic for a specific agent in the Scene.

ParameterTypeDescription
indexuintThe index of the agent to get.

Returns: AgentPublic — Returns null if the index is larger than the number of agents in the Scene.

Remarks

Agents may appear at different indices as they join and part.

GetAgents

public IEnumerable<AgentPublic> GetAgents()

Returns the current list of Agents in the Scene.

Returns: IEnumerable<AgentPublic> — The current list of agents in the Scene

GetPortalCreatorName

public string GetPortalCreatorName(Sansar.Script.ObjectId objectId)

The name of the user who created the specified portal.

ParameterTypeDescription
objectIdSansar.Script.ObjectId

Returns: string — String

Remarks

User who created the portal.

GetPortalDescription

public string GetPortalDescription(Sansar.Script.ObjectId objectId)

Description for the specified portal.

ParameterTypeDescription
objectIdSansar.Script.ObjectId

Returns: string — String

Remarks

The description of the portal.

GetPortalUri

public string GetPortalUri(Sansar.Script.ObjectId objectId)

URI destination for the specified portal.

ParameterTypeDescription
objectIdSansar.Script.ObjectId

Returns: string — String

Remarks

The URI of the destination of the portal.

ToString

public override string ToString()

A string representation of this object.

Returns: string — A string representation of this object.

Remarks

The format of this string may change between releases.

Used in examples

Generated from the Sansar 47.10.0 client ScriptApi snapshot.