# Client

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
</div>

<span id="T:Sansar.Simulation.Client"></span>

The Client class is used for access to the Client connected to a [`AgentPrivate`](/scripting/api/sansar.simulation/agentprivate).

```csharp
public class Client : Sansar.Script.InstanceInterface
```

## Remarks

This class is also used for receiving input events from a client.

## Members at a glance

| Kind | Members |
|---|---|
| **Properties** | [AgentInfo](#agentinfo) · [InVrAndHandsActive](#invrandhandsactive) · [UI](#ui) |
| **Methods** | [CaptureImage](#captureimage) · [ClearTutorialHint](#cleartutorialhint) · [EnableAutomaticTutorialHints](#enableautomatictutorialhints) · [GetActiveCamera](#getactivecamera) · [OpenQuestCharacterDialog](#openquestcharacterdialog) · [OpenStoreListing](#openstorelisting) · [OpenUserStore](#openuserstore) · [ResetCamera](#resetcamera) · [SendChat](#sendchat) · [SetActiveCamera](#setactivecamera) · [ShakeCamera](#shakecamera)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ShowTutorialHint](#showtutorialhint) · [StopAllCameraShakes](#stopallcamerashakes)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [SubscribeToCommand](#subscribetocommand) · [SubscribeToTwitch](#subscribetotwitch) · [TeleportTo](#teleportto) · [TeleportToCharacterEditor](#teleporttocharactereditor) · [TeleportToLocation](#teleporttolocation) · [TeleportToLookbook](#teleporttolookbook) · [TeleportToUri](#teleporttouri) · [ToString](#tostring) · [VibrationPulse](#vibrationpulse) |

## Properties

### AgentInfo

<div class="api-card">
<span id="P:Sansar.Simulation.Client.AgentInfo"></span>

```csharp signature
public AgentInfo AgentInfo { get; }
```

Returns the [`AgentInfo`](/scripting/api/sansar.simulation/agentinfo) for this instance.

**Value:** [AgentInfo](/scripting/api/sansar.simulation/agentinfo) — The [`AgentInfo`](/scripting/api/sansar.simulation/agentinfo) for this instance

<details class="api-remarks"><summary>Remarks</summary>

The [`AgentInfo`](/scripting/api/sansar.simulation/agentinfo) holds information about an agent.

</details>

</div>

### InVrAndHandsActive

<div class="api-card">
<span id="P:Sansar.Simulation.Client.InVrAndHandsActive"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 39.1.0</span></div>

```csharp signature
public bool InVrAndHandsActive { get; }
```

Retrieves whether or not this Client is using a VR headset and using hand tracking controllers currently.

**Value:** [bool](https://learn.microsoft.com/dotnet/api/system.boolean) — Whether or not this Client is using a VR headset and using hand tracking controllers currently.

</div>

### UI

<div class="api-card">
<span id="P:Sansar.Simulation.Client.UI"></span>

```csharp signature
public UI UI { get; }
```

Returns the [`UI`](/scripting/api/sansar.simulation/ui) for this instance.

**Value:** [UI](/scripting/api/sansar.simulation/ui) — The [`UI`](/scripting/api/sansar.simulation/ui) for this instance

<details class="api-remarks"><summary>Remarks</summary>

The [`UI`](/scripting/api/sansar.simulation/ui) for this instance.

</details>

</div>


## Methods

### CaptureImage

<div class="api-card">
<span id="M:Sansar.Simulation.Client.CaptureImage(Sansar.Simulation.CameraComponent)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 43.2.1</span></div>

```csharp signature
public void CaptureImage(CameraComponent component)
```

Take a image from the camera point of view

| Parameter | Type | Description |
|---|---|---|
| `component` | [CameraComponent](/scripting/api/sansar.simulation/cameracomponent) |  |

</div>

### ClearTutorialHint

<div class="api-card" id="cleartutorialhint-noargs">
<span id="M:Sansar.Simulation.Client.ClearTutorialHint"></span>
<span id="M:Sansar.Simulation.Client.ClearTutorialHint()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void ClearTutorialHint()
```

Clears any scripted tutorial hint being shown to the player

</div>

<div class="api-card" id="cleartutorialhint-action">
<span id="M:Sansar.Simulation.Client.ClearTutorialHint(System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void ClearTutorialHint(
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Clears any scripted tutorial hint being shown to the player

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

</div>

### EnableAutomaticTutorialHints

<div class="api-card" id="enableautomatictutorialhints-boolean">
<span id="M:Sansar.Simulation.Client.EnableAutomaticTutorialHints(System.Boolean)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void EnableAutomaticTutorialHints(bool enabled)
```

Enables / Disables automatic (non-scripted) tutorial hints.

| Parameter | Type | Description |
|---|---|---|
| `enabled` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Enabled state of automatic hints. |

<details class="api-remarks"><summary>Remarks</summary>

If the user has disabled hints in the settings menu, enabling them from script will have no effect.

</details>

</div>

<div class="api-card" id="enableautomatictutorialhints-boolean-action">
<span id="M:Sansar.Simulation.Client.EnableAutomaticTutorialHints(System.Boolean,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void EnableAutomaticTutorialHints(
    bool enabled,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Enables / Disables automatic (non-scripted) tutorial hints.

| Parameter | Type | Description |
|---|---|---|
| `enabled` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Enabled state of automatic hints. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

If the user has disabled hints in the settings menu, enabling them from script will have no effect.

</details>

</div>

### GetActiveCamera

<div class="api-card">
<span id="M:Sansar.Simulation.Client.GetActiveCamera"></span>
<span id="M:Sansar.Simulation.Client.GetActiveCamera()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public CameraComponent GetActiveCamera()
```

Returns the active camera for this instance.

**Returns:** [CameraComponent](/scripting/api/sansar.simulation/cameracomponent) — The active camera for this instance

</div>

### OpenQuestCharacterDialog

<div class="api-card">
<span id="M:Sansar.Simulation.Client.OpenQuestCharacterDialog(Sansar.Simulation.QuestCharacter)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 35.1.0</span></div>

```csharp signature
public void OpenQuestCharacterDialog(QuestCharacter character)
```

Opens the quest dialog for a character.

| Parameter | Type | Description |
|---|---|---|
| `character` | [QuestCharacter](/scripting/api/sansar.simulation/questcharacter) | The character to open the quest dialog for. |

</div>

### OpenStoreListing

<div class="api-card">
<span id="M:Sansar.Simulation.Client.OpenStoreListing(System.Guid)"></span>

```csharp signature
public void OpenStoreListing(Guid productId)
```

Opens the product&#39;s Store page.

| Parameter | Type | Description |
|---|---|---|
| `productId` | [Guid](https://learn.microsoft.com/dotnet/api/system.guid) | A product ID from a Sansar store listing. |

</div>

### OpenUserStore

<div class="api-card">
<span id="M:Sansar.Simulation.Client.OpenUserStore(System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public void OpenUserStore(string creatorHandle)
```

Opens the user&#39;s Store page.

| Parameter | Type | Description |
|---|---|---|
| `creatorHandle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Creator handle: Creator&#39;s handle Sansar store. |

</div>

### ResetCamera

<div class="api-card">
<span id="M:Sansar.Simulation.Client.ResetCamera"></span>
<span id="M:Sansar.Simulation.Client.ResetCamera()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public void ResetCamera()
```

Resets the active camera for this Client to the system default

</div>

### SendChat

<div class="api-card">
<span id="M:Sansar.Simulation.Client.SendChat(System.String)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. Use AgentPrivate.SendChat or AgentPublic.SendChat", false)]
public void SendChat(string message)
```

Sends a [`String`](https://learn.microsoft.com/dotnet/api/system.string) message to the $className$.

| Parameter | Type | Description |
|---|---|---|
| `message` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The message to send. |

**Throws** [`NullReferenceException`](https://learn.microsoft.com/dotnet/api/system.nullreferenceexception): If the user is no longer online.

**Throws** [`ThrottleException`](/scripting/api/sansar.script/throttleexception): If the throttle rate is exceeded.

<details class="api-remarks"><summary>Remarks</summary>

eprecated. Use AgentPrivate.SendChat or AgentPublic.SendChat

</details>

</div>

### SetActiveCamera

<div class="api-card" id="setactivecamera-cameracomponent">
<span id="M:Sansar.Simulation.Client.SetActiveCamera(Sansar.Simulation.CameraComponent)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public void SetActiveCamera(CameraComponent component)
```

Sets the active camera for this Client.

| Parameter | Type | Description |
|---|---|---|
| `component` | [CameraComponent](/scripting/api/sansar.simulation/cameracomponent) | The camera component to set |

</div>

<div class="api-card" id="setactivecamera-cameracomponent-scriptcameracontrolmode">
<span id="M:Sansar.Simulation.Client.SetActiveCamera(Sansar.Simulation.CameraComponent,Sansar.Simulation.ScriptCameraControlMode)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public void SetActiveCamera(
    CameraComponent component,
    ScriptCameraControlMode controlMode
)
```

Sets the active camera for this Client.

| Parameter | Type | Description |
|---|---|---|
| `component` | [CameraComponent](/scripting/api/sansar.simulation/cameracomponent) | The camera component to set |
| `controlMode` | [ScriptCameraControlMode](/scripting/api/sansar.simulation/scriptcameracontrolmode) | The script camera control mode to set |

</div>

### ShakeCamera

<div class="api-card">
<span id="M:Sansar.Simulation.Client.ShakeCamera(Sansar.Simulation.CameraShakeSettings)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public CameraShakeHandle ShakeCamera(CameraShakeSettings settings)
```

Shakes this player&#39;s rendered camera, subject to player comfort settings.

| Parameter | Type | Description |
|---|---|---|
| `settings` | [CameraShakeSettings](/scripting/api/sansar.simulation/camerashakesettings) | Settings to snapshot, or null for fresh default settings. |

**Returns:** [CameraShakeHandle](/scripting/api/sansar.simulation/camerashakehandle) — A non-null handle for this script&#39;s request, including inert requests.

<details class="api-remarks"><summary>Remarks</summary>

Only the rendered view changes; camera transforms, audio and targeting are unaffected. Player comfort settings and VR limits can reduce or suppress any shake. Leaving the world ends it.

```csharp title="CameraShakeExample.cs"
/* This example is licensed under the Creative Commons Attribution 4.0 International License.
 * Copyright 2026 Sansar, Inc. https://creativecommons.org/licenses/by/4.0/
 */

using System;
using System.Collections.Generic;
using Sansar;
using Sansar.Script;
using Sansar.Simulation;

/// <summary>Demonstrates camera shake with chat commands on the default channel.</summary>
/// <remarks>Use /shake rumble, jitter, sway, impact, near, engine or stop.
/// Engine toggles a continuous rumble for the sender; stop clears this script's shakes for everyone.
/// An optional CameraComponent on this object fixes the view for current and future users.
/// Player comfort settings and VR limits can reduce or suppress the motion.</remarks>
public class CameraShakeExample : SceneObjectScript
{
    private CameraComponent camera;
    private readonly Dictionary<SessionId, CameraShakeHandle> engines =
        new Dictionary<SessionId, CameraShakeHandle>();

    /// <summary>Sets up chat commands and the optional fixed camera.</summary>
    public override void Init()
    {
        ObjectPrivate.TryGetFirstComponent(out camera);
        ScenePrivate.User.Subscribe(User.AddUser, OnUserAdded);
        ScenePrivate.User.Subscribe(User.RemoveUser, OnUserRemoved);
        ScenePrivate.Chat.Subscribe(Chat.DefaultChannel, OnChat, true);

        // Script reloads also need to set up users who are already in the world.
        foreach (AgentPrivate agent in ScenePrivate.GetAgents())
        {
            SetCamera(agent);
        }

        // The Debug local-source live test requires this marker from the real body.
        Log.Write("CameraShakeExample ready (real shake body): /shake rumble, jitter, sway, impact, near, engine, stop");
    }

    private void SetCamera(AgentPrivate agent)
    {
        if (camera != null && agent != null && agent.IsValid)
        {
            agent.Client.SetActiveCamera(camera, ScriptCameraControlMode.AgentControlOnly);
        }
    }

    private void OnUserAdded(UserData data)
    {
        SetCamera(ScenePrivate.FindAgent(data.User));
    }

    private void OnUserRemoved(UserData data)
    {
        // Leaving the world ends that player's shake; discard the old session's handle.
        engines.Remove(data.User);
    }

    private bool StopEngine(SessionId sessionId)
    {
        CameraShakeHandle engine;
        if (!engines.TryGetValue(sessionId, out engine))
        {
            return false;
        }

        engine.Stop(0.25f);
        engines.Remove(sessionId);
        return true;
    }

    private void OnChat(ChatData data)
    {
        string[] words = data.Message.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 2 || !words[0].Equals("/shake", StringComparison.OrdinalIgnoreCase))
        {
            return;
        }

        // SourceId identifies the sender, rather than the object running this script.
        AgentPrivate agent = ScenePrivate.FindAgent(data.SourceId);
        if (agent == null || !agent.IsValid)
        {
            return;
        }
        SessionId sessionId = agent.AgentInfo.SessionId;

        switch (words[1].ToLowerInvariant())
        {
            case "rumble":
                // Presets are mutable: edit before starting. Starts snapshot the settings.
                CameraShakeSettings rumble = CameraShakeSettings.Earthquake();
                rumble.Direction = new Vector(1, 0.5f, 0);
                agent.Client.ShakeCamera(rumble);
                break;

            case "jitter":
                agent.Client.ShakeCamera(new CameraShakeSettings
                {
                    Pattern = CameraShakePattern.Jitter,
                    Magnitude = 0.25f,
                    Duration = 1.0f
                    // Frequency 0 uses Jitter's default of 20 Hz.
                });
                break;

            case "sway":
                // Long side-to-side motion for the fixed-camera pixel-displacement test.
                agent.Client.ShakeCamera(new CameraShakeSettings
                {
                    Pattern = CameraShakePattern.Sway,
                    Magnitude = 0.6f,
                    Frequency = 2.0f,
                    Duration = 6.0f,
                    Direction = new Vector(1, 0, 0),
                    FadeOut = 0.3f
                });
                break;

            case "impact":
                // Landing: one downward kick. Duration 0 would still give just one kick.
                agent.Client.ShakeCamera(CameraShakeSettings.Impact(new Vector(0, -1, 0)));
                break;

            case "near":
                // Only players present now receive this explosion. Their camera distance
                // from this object's world position controls falloff to zero at 20 meters.
                ScenePrivate.ShakeCameraAtPosition(ObjectPrivate.Position, 20.0f,
                    CameraShakeSettings.Explosion());
                break;

            case "engine":
                // Send again to stop; separate sessions retain separate handles.
                if (!StopEngine(sessionId))
                {
                    engines[sessionId] = agent.Client.ShakeCamera(CameraShakeSettings.EngineRumble());
                }
                break;

            case "stop":
                StopEngine(sessionId);
                // Both stop-all scopes affect only shakes requested by this script.
                agent.Client.StopAllCameraShakes();
                ScenePrivate.StopAllCameraShakes();
                engines.Clear();
                break;
        }
    }
}
```

<p class="api-example-source">Source: <code>Examples/CameraShakeExample.cs</code> in the Sansar 47.10.0 client ScriptApi snapshot.</p>

</details>

</div>

### ShowTutorialHint

<div class="api-card" id="showtutorialhint-tutorialhint">
<span id="M:Sansar.Simulation.Client.ShowTutorialHint(Sansar.Simulation.TutorialHint)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void ShowTutorialHint(TutorialHint hint)
```

Show a tutorial hint to the player

| Parameter | Type | Description |
|---|---|---|
| `hint` | [TutorialHint](/scripting/api/sansar.simulation/tutorialhint) | The hint to show. |

</div>

<div class="api-card" id="showtutorialhint-tutorialhint-action">
<span id="M:Sansar.Simulation.Client.ShowTutorialHint(Sansar.Simulation.TutorialHint,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 32.0.0</span></div>

```csharp signature
public void ShowTutorialHint(
    TutorialHint hint,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Show a tutorial hint to the player

| Parameter | Type | Description |
|---|---|---|
| `hint` | [TutorialHint](/scripting/api/sansar.simulation/tutorialhint) | The hint to show. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

</div>

<div class="api-card" id="showtutorialhint-tutorialhint-int32">
<span id="M:Sansar.Simulation.Client.ShowTutorialHint(Sansar.Simulation.TutorialHint,System.Int32)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 36.9.0</span></div>

```csharp signature
public void ShowTutorialHint(TutorialHint hint, int variant)
```

Show a tutorial hint to the player

| Parameter | Type | Description |
|---|---|---|
| `hint` | [TutorialHint](/scripting/api/sansar.simulation/tutorialhint) | The hint to show. |
| `variant` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Optional variant of the hint to show. |

</div>

<div class="api-card" id="showtutorialhint-tutorialhint-int32-action">
<span id="M:Sansar.Simulation.Client.ShowTutorialHint(Sansar.Simulation.TutorialHint,System.Int32,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 36.9.0</span></div>

```csharp signature
public void ShowTutorialHint(
    TutorialHint hint,
    int variant,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Show a tutorial hint to the player

| Parameter | Type | Description |
|---|---|---|
| `hint` | [TutorialHint](/scripting/api/sansar.simulation/tutorialhint) | The hint to show. |
| `variant` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Optional variant of the hint to show. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

</div>

### StopAllCameraShakes

<div class="api-card">
<span id="M:Sansar.Simulation.Client.StopAllCameraShakes(System.Single)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void StopAllCameraShakes(float fadeOut)
```

Stops all shakes from the calling script on this player, including area shakes.

| Parameter | Type | Description |
|---|---|---|
| `fadeOut` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Ending fade in seconds, clamped to 0 through 5; defaults to 0.1. |

<details class="api-remarks"><summary>Remarks</summary>

0 stops immediately. Shakes from other scripts are unaffected.

</details>

</div>

### SubscribeToCommand

<div class="api-card" id="subscribetocommand-string-action-action-boolean">
<span id="M:Sansar.Simulation.Client.SubscribeToCommand(System.String,System.Action{Sansar.Simulation.CommandData},System.Action{Sansar.Script.CancelData},System.Boolean)"></span>

```csharp signature
public Sansar.Script.IEventSubscription SubscribeToCommand(
    string Command,
    Action<CommandData> callback,
    Action<Sansar.Script.CancelData> canceled,
    bool persistent
)
```

Subscribes to Command Events.

| Parameter | Type | Description |
|---|---|---|
| `Command` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The command which occurred. |
| `callback` | [Action&lt;CommandData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the event completes. |
| `canceled` | [Action&lt;Sansar.Script.CancelData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the subscription is canceled. |
| `persistent` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Optional, set to false to unsubscribe after one event. |

**Returns:** [Sansar.Script.IEventSubscription](/scripting/api/sansar.script/ieventsubscription) — An [`IEventSubscription`](/scripting/api/sansar.script/ieventsubscription) that can be used to cancel the subscription.

</div>

<div class="api-card" id="subscribetocommand-string-commandaction-action-action-boolean">
<span id="M:Sansar.Simulation.Client.SubscribeToCommand(System.String,Sansar.Simulation.CommandAction,System.Action{Sansar.Simulation.CommandData},System.Action{Sansar.Script.CancelData},System.Boolean)"></span>

```csharp signature
public Sansar.Script.IEventSubscription SubscribeToCommand(
    string Command,
    CommandAction Action,
    Action<CommandData> callback,
    Action<Sansar.Script.CancelData> canceled,
    bool persistent
)
```

Subscribes to Command Events.

| Parameter | Type | Description |
|---|---|---|
| `Command` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The command which occurred. |
| `Action` | [CommandAction](/scripting/api/sansar.simulation/commandaction) | The action which occurred. |
| `callback` | [Action&lt;CommandData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the event completes. |
| `canceled` | [Action&lt;Sansar.Script.CancelData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the subscription is canceled. |
| `persistent` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Optional, set to false to unsubscribe after one event. |

**Returns:** [Sansar.Script.IEventSubscription](/scripting/api/sansar.script/ieventsubscription) — An [`IEventSubscription`](/scripting/api/sansar.script/ieventsubscription) that can be used to cancel the subscription.

</div>

### SubscribeToTwitch

<div class="api-card" id="subscribetotwitch-action-boolean">
<span id="M:Sansar.Simulation.Client.SubscribeToTwitch(System.Action{Sansar.Simulation.TwitchData},System.Boolean)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 38.1.0</span></div>

```csharp signature
public Sansar.Script.IEventSubscription SubscribeToTwitch(
    Action<TwitchData> callback,
    bool persistent
)
```

Subscribes to Twitch Events.

| Parameter | Type | Description |
|---|---|---|
| `callback` | [Action&lt;TwitchData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the event completes. |
| `persistent` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Optional, set to false to unsubscribe after one event. |

**Returns:** [Sansar.Script.IEventSubscription](/scripting/api/sansar.script/ieventsubscription) — An [`IEventSubscription`](/scripting/api/sansar.script/ieventsubscription) that can be used to cancel the subscription.

</div>

<div class="api-card" id="subscribetotwitch-twitcheventtype-action-boolean">
<span id="M:Sansar.Simulation.Client.SubscribeToTwitch(Sansar.Simulation.TwitchEventType,System.Action{Sansar.Simulation.TwitchData},System.Boolean)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 38.1.0</span></div>

```csharp signature
public Sansar.Script.IEventSubscription SubscribeToTwitch(
    TwitchEventType EventType,
    Action<TwitchData> callback,
    bool persistent
)
```

Subscribes to Twitch Events.

| Parameter | Type | Description |
|---|---|---|
| `EventType` | [TwitchEventType](/scripting/api/sansar.simulation/twitcheventtype) | The event which occurred |
| `callback` | [Action&lt;TwitchData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Callback which is executed when the event completes. |
| `persistent` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Optional, set to false to unsubscribe after one event. |

**Returns:** [Sansar.Script.IEventSubscription](/scripting/api/sansar.script/ieventsubscription) — An [`IEventSubscription`](/scripting/api/sansar.script/ieventsubscription) that can be used to cancel the subscription.

</div>

### TeleportTo

<div class="api-card" id="teleportto-string">
<span id="M:Sansar.Simulation.Client.TeleportTo(System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 39.0.0</span></div>

```csharp signature
public void TeleportTo(string spawnPointName)
```

Teleports to a spawn point in the scene

| Parameter | Type | Description |
|---|---|---|
| `spawnPointName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The name of the target spawn point in the destination. |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

<div class="api-card" id="teleportto-vector-vector">
<span id="M:Sansar.Simulation.Client.TeleportTo(Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public void TeleportTo(Sansar.Vector position, Sansar.Vector forward)
```

Teleports to the position facing the specified direction

| Parameter | Type | Description |
|---|---|---|
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | The teleport destination position. |
| `forward` | [Sansar.Vector](/scripting/api/sansar/vector) | The teleport destination forward direction. |

<details class="api-remarks"><summary>Remarks</summary>

The agent will be set to the specified position facing the given forward direction. Note that avatars always remain upright so the Z component of the forward vector will be ignored.

</details>

</div>

### TeleportToCharacterEditor

<div class="api-card" id="teleporttocharactereditor-noargs">
<span id="M:Sansar.Simulation.Client.TeleportToCharacterEditor"></span>
<span id="M:Sansar.Simulation.Client.TeleportToCharacterEditor()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public void TeleportToCharacterEditor()
```

Teleports to the Character Editor

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

<div class="api-card" id="teleporttocharactereditor-string">
<span id="M:Sansar.Simulation.Client.TeleportToCharacterEditor(System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public void TeleportToCharacterEditor(string returnSpawnPointName)
```

Teleports to the Character Editor

| Parameter | Type | Description |
|---|---|---|
| `returnSpawnPointName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | When returning to the world from the character editor, this spawn point will be used |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

### TeleportToLocation

<div class="api-card" id="teleporttolocation-string-string">
<span id="M:Sansar.Simulation.Client.TeleportToLocation(System.String,System.String)"></span>

```csharp signature
public void TeleportToLocation(string avatarId, string locationHandle)
```

Teleports the personaHandle to the locationHandle.

| Parameter | Type | Description |
|---|---|---|
| `avatarId` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The [`SceneInfo.AvatarId`](/scripting/api/sansar.simulation/sceneinfo#avatarid) of the destination creator. |
| `locationHandle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The [`SceneInfo.LocationHandle`](/scripting/api/sansar.simulation/sceneinfo#locationhandle) of the destination. |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

<div class="api-card" id="teleporttolocation-string-string-string">
<span id="M:Sansar.Simulation.Client.TeleportToLocation(System.String,System.String,System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.0.0</span></div>

```csharp signature
public void TeleportToLocation(
    string avatarId,
    string locationHandle,
    string spawnPointName
)
```

Teleports the personaHandle to the locationHandle.

| Parameter | Type | Description |
|---|---|---|
| `avatarId` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The [`SceneInfo.AvatarId`](/scripting/api/sansar.simulation/sceneinfo#avatarid) of the destination creator. |
| `locationHandle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The [`SceneInfo.LocationHandle`](/scripting/api/sansar.simulation/sceneinfo#locationhandle) of the destination. |
| `spawnPointName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The name of the target spawn point in the destination. |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

### TeleportToLookbook

<div class="api-card" id="teleporttolookbook-noargs">
<span id="M:Sansar.Simulation.Client.TeleportToLookbook"></span>
<span id="M:Sansar.Simulation.Client.TeleportToLookbook()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public void TeleportToLookbook()
```

Teleports to the Lookbook

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

<div class="api-card" id="teleporttolookbook-string">
<span id="M:Sansar.Simulation.Client.TeleportToLookbook(System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public void TeleportToLookbook(string returnSpawnPointName)
```

Teleports to the Lookbook

| Parameter | Type | Description |
|---|---|---|
| `returnSpawnPointName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | When returning to the world from the lookbook, this spawn point will be used |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

### TeleportToUri

<div class="api-card">
<span id="M:Sansar.Simulation.Client.TeleportToUri(System.String)"></span>

```csharp signature
public void TeleportToUri(string sansarUri)
```

Teleports to the specified URI

| Parameter | Type | Description |
|---|---|---|
| `sansarUri` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The URI to teleport to. |

<details class="api-remarks"><summary>Remarks</summary>

Teleports may be throttled.

</details>

</div>

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.Client.ToString"></span>
<span id="M:Sansar.Simulation.Client.ToString()"></span>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>

### VibrationPulse

<div class="api-card">
<span id="M:Sansar.Simulation.Client.VibrationPulse(Sansar.Simulation.ControlPointType,System.Single,System.Single)"></span>

```csharp signature
public void VibrationPulse(
    ControlPointType type,
    float intensity,
    float duration
)
```

Pulses the vibration haptic motor for a control point.

| Parameter | Type | Description |
|---|---|---|
| `type` | [ControlPointType](/scripting/api/sansar.simulation/controlpointtype) | See [`ControlPointType`](/scripting/api/sansar.simulation/controlpointtype) |
| `intensity` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Intensity of vibration.  Intensity will be clamped to the range \[0, 1\]. |
| `duration` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Duration of the pulse in milliseconds.  Will be clamped to the range \[0, 1000\]. |

</div>


## Used in examples

- [MoverExample1.cs](/scripting/examples/mover-examples)
- [StatsExample.cs](/scripting/examples/stats-example)
- [TeleportHotkeys.cs](/scripting/examples/teleport-hotkeys)
- [VisitorTrackerExample.cs](/scripting/examples/visitor-tracker)
- [BanHammerExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/BanHammerExample.cs)
- `CameraShakeExample.cs`
- [CastRayExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/CastRayExample.cs)
- [CommandExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/CommandExample.cs)
- [CommandScreenshot.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/CommandScreenshot.cs)
- [InteractionScreenshot.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/InteractionScreenshot.cs)
- [PewPewExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/PewPewExample.cs)
- [ScriptLibrary/Quest/QuestObjectBase.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Quest/QuestObjectBase.cs)

…and 13 more examples in the snapshot.

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>