public class Interaction : Sansar.Script.InstanceInterfaceMembers at a glance
| Kind | Members |
|---|---|
| Methods | GetEnabled · GetPrompt · SetEnabled · SetPrompt · Subscribe |
Methods
GetEnabled
public bool GetEnabled()Returns true if the interaction is enabled.
Returns: bool — true if the interaction is enabled.
Remarks
Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.
GetPrompt
public string GetPrompt()Get the current Interaction prompt.
Returns: string — The current prompt string.
Remarks
The prompt text shows when hovering over the object the script is on.
SetEnabled
public void SetEnabled(bool value)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
value | bool | true to enable the Interaction, false to disable it. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.
public void SetEnabled(Sansar.Script.SessionId sessionId, bool value)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The SessionId of the agent to disable or enable the interaction for.. |
value | bool | true to enable the Interaction, false to disable it. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.
public void SetEnabled(AgentPrivate agent, bool value)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to disable or enable the interaction for. |
value | bool | true to enable the Interaction, false to disable it. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetEnabled(
bool value,
Sansar.Script.ScriptBase.OperationComplete handler
)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
value | bool | true to enable the Interaction, false to disable it. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — A legacy eventId
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.
public void SetEnabled(
bool value,
Action<Sansar.Script.OperationCompleteEvent> handler
)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
value | bool | true to enable the Interaction, false to disable it. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’.
public void SetEnabled(
Sansar.Script.SessionId sessionId,
bool value,
Action<Sansar.Script.OperationCompleteEvent> handler
)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The SessionId of the agent to disable or enable the interaction for.. |
value | bool | true to enable the Interaction, false to disable it. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.
public void SetEnabled(
AgentPrivate agent,
bool value,
Action<Sansar.Script.OperationCompleteEvent> handler
)Change an Interaction state to disabled or enabled.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to disable or enable the interaction for. |
value | bool | true to enable the Interaction, false to disable it. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
All Interactions start off enabled. Disabled interactions do not highlight, do not show their prompt and cannot be ‘clicked’. This method will only change the enabled state for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setEnabled calls.
SetPrompt
public void SetPrompt(string prompt)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
prompt | string | The string to set the prompt to. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.
public void SetPrompt(
Sansar.Script.SessionId sessionId,
string prompt
)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The sessionId of the user to change the prompt for. |
prompt | string | The string to set the prompt to. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.
public void SetPrompt(AgentPrivate agent, string prompt)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to change the prompt for. |
prompt | string | The string to set the prompt to. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetPrompt(
string prompt,
Sansar.Script.ScriptBase.OperationComplete handler
)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
prompt | string | The string to set the prompt to. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — A legacy eventId
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.
public void SetPrompt(
string prompt,
Action<Sansar.Script.OperationCompleteEvent> handler
)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
prompt | string | The string to set the prompt to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Use DefaultValueAttribute to set a default prompt.
public void SetPrompt(
Sansar.Script.SessionId sessionId,
string prompt,
Action<Sansar.Script.OperationCompleteEvent> handler
)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
sessionId | Sansar.Script.SessionId | The sessionId of the user to change the prompt for. |
prompt | string | The string to set the prompt to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.
public void SetPrompt(
AgentPrivate agent,
string prompt,
Action<Sansar.Script.OperationCompleteEvent> handler
)Set the Interaction prompt string.
| Parameter | Type | Description |
|---|---|---|
agent | AgentPrivate | The agent to change the prompt for. |
prompt | string | The string to set the prompt to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The prompt text shows when hovering over the object the script is on. The prompt must be 128 characters or less and 4 lines or less. Will only change the prompt for a single user and will not persist across client restarts, server restarts, or leaving the scene (even for changing avatars). It will also be overriden by any global setPrompt calls.
Subscribe
public Sansar.Script.IEventSubscription Subscribe(
Action<InteractionData> callback,
bool persistent
)Subscribes to Interaction Events.
| Parameter | Type | Description |
|---|---|---|
callback | Action<InteractionData> | Callback which is executed when the event completes. |
persistent | bool | Optional, set to false to unsubscribe after one event. |
Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.
Used in examples
- MoverExample1.cs
- MoverExample3.cs
- InteractionExample.cs
- InteractionScreenshot.cs
- MyScripts/HelloWorld.cs
- ScriptLibrary/Quest/QuestCharacter.cs
- ScriptLibrary/Quest/QuestGiver.cs
- ScriptLibrary/Quest/QuestGiverInteraction.cs
- ScriptLibrary/Quest/QuestObject.cs
- ScriptLibrary/Quest/QuestObjectInteraction.cs
- ScriptLibrary/Scene/HintText.cs
- ScriptLibrary/Scene/Interaction.cs
…and 1 more examples in the snapshot.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.