The MeshComponent handles interactions with static meshes.
public class MeshComponent : Sansar.Script.InstanceInterfaceMembers at a glance
| Kind | Members |
|---|---|
| Fields | ComponentType |
| Properties | ComponentId · IsScriptable · Name |
| Methods | GetIsVisible · GetRenderMaterial · GetRenderMaterials · SetIsVisible · ToString |
Fields
ComponentType
public static readonly ComponentType ComponentTypeThe MeshComponent.ComponentType of this component
Properties
ComponentId
public Sansar.Script.ComponentId ComponentId { get; }Retrieves the component id for this MeshComponent.
Value: Sansar.Script.ComponentId — The id.
IsScriptable
public bool IsScriptable { get; }The scriptable flag for this MeshComponent.
Value: bool — Whether or not this mesh can have properties changed by script.
Name
public string Name { get; }This MeshComponent name, as specified in the editor.
Methods
GetIsVisible
public bool GetIsVisible()Retrieves the visibility state of this MeshComponent.
Returns: bool — The visibility state.
GetRenderMaterial
public RenderMaterial GetRenderMaterial(string renderMaterialName)Gets a specific RenderMaterial or null if there is no RenderMaterial of that name.
| Parameter | Type | Description |
|---|---|---|
renderMaterialName | string | renderMaterialName |
Returns: RenderMaterial
GetRenderMaterials
public IEnumerable<RenderMaterial> GetRenderMaterials()Gets the array of all RenderMaterials for this MeshComponent.
Returns: IEnumerable<RenderMaterial>
SetIsVisible
public void SetIsVisible(bool isVisible)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
isVisible | bool | The 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.
public void SetIsVisible(
Sansar.Script.SessionId sessionId,
bool isVisible
)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The sessionId of the user to change static mesh visibility for. |
isVisible | bool | The 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).
public void SetIsVisible(AgentPrivate agent, bool isVisible)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to change static mesh visibility for. |
isVisible | bool | The 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).
public void SetIsVisible(
bool isVisible,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
isVisible | bool | The visibility state to set. |
handler | Action<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.
public void SetIsVisible(
Sansar.Script.SessionId sessionId,
bool isVisible,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The sessionId of the user to change static mesh visibility for. |
isVisible | bool | The visibility state to set. |
handler | Action<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).
public void SetIsVisible(
AgentPrivate agent,
bool isVisible,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the visibility state of this MeshComponent.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to change static mesh visibility for. |
isVisible | bool | The visibility state to set. |
handler | Action<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
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
- MeshVisibilityExample.cs
- ScriptLibrary/Quest/QuestObjectInteraction.cs
- ScriptLibrary/Quest/QuestVisibility.cs
- ScriptLibrary/Scene/Visibility.cs
Generated from the Sansar 47.10.0 client ScriptApi snapshot.