Skip to content

Get Sansar

Script API

MeshComponent

Where: Client
More page actions

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

Class Namespace Sansar.Simulation Inherits Sansar.Script.InstanceInterface Added in 34.0.0

The MeshComponent handles interactions with static meshes.

public class MeshComponent : Sansar.Script.InstanceInterface

Members at a glance

KindMembers
FieldsComponentType
PropertiesComponentId · IsScriptable · Name
MethodsGetIsVisible · GetRenderMaterial · GetRenderMaterials · SetIsVisible · ToString

Fields

ComponentType

Added in 34.0.0
public static readonly ComponentType ComponentType

The MeshComponent.ComponentType of this component

Properties

ComponentId

Added in 34.0.0
public Sansar.Script.ComponentId ComponentId { get; }

Retrieves the component id for this MeshComponent.

Value: Sansar.Script.ComponentId — The id.

IsScriptable

Added in 34.0.0
public bool IsScriptable { get; }

The scriptable flag for this MeshComponent.

Value: bool — Whether or not this mesh can have properties changed by script.

Name

Added in 34.0.0
public string Name { get; }

This MeshComponent name, as specified in the editor.

Methods

GetIsVisible

Added in 34.0.0
public bool GetIsVisible()

Retrieves the visibility state of this MeshComponent.

Returns: bool — The visibility state.

GetRenderMaterial

Added in 37.0.0
public RenderMaterial GetRenderMaterial(string renderMaterialName)

Gets a specific RenderMaterial or null if there is no RenderMaterial of that name.

ParameterTypeDescription
renderMaterialNamestringrenderMaterialName

Returns: RenderMaterial

GetRenderMaterials

Added in 37.0.0
public IEnumerable<RenderMaterial> GetRenderMaterials()

Gets the array of all RenderMaterials for this MeshComponent.

Returns: IEnumerable<RenderMaterial>

SetIsVisible

Added in 34.0.0
public void SetIsVisible(bool isVisible)

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
isVisibleboolThe visibility state to set.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Added in 34.0.0
public void SetIsVisible(     Sansar.Script.SessionId sessionId,     bool isVisible )

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe sessionId of the user to change static mesh visibility for.
isVisibleboolThe visibility state to set.
Remarks

It will only change static mesh visibility for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars).

Added in 34.0.0
public void SetIsVisible(AgentPrivate agent, bool isVisible)

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
agentAgentPrivateThe agent to change static mesh visibility for.
isVisibleboolThe visibility state to set.
Remarks

It will only change static mesh visibility for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars).

Added in 34.0.0
public void SetIsVisible(     bool isVisible,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
isVisibleboolThe visibility state to set.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Added in 34.0.0
public void SetIsVisible(     Sansar.Script.SessionId sessionId,     bool isVisible,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
sessionIdSansar.Script.SessionIdThe sessionId of the user to change static mesh visibility for.
isVisibleboolThe visibility state to set.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

It will only change static mesh visibility for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars).

Added in 34.0.0
public void SetIsVisible(     AgentPrivate agent,     bool isVisible,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the visibility state of this MeshComponent.

ParameterTypeDescription
agentAgentPrivateThe agent to change static mesh visibility for.
isVisibleboolThe visibility state to set.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

It will only change static mesh visibility for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars).

ToString

Added in 34.0.0
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.