A running script in Sansar.
public class ScriptHandle : IDisposableRemarks
This is a lightweight handle which is used by some API methods to refer to a script.
Members at a glance
| Kind | Members |
|---|---|
| Properties | ID · UnhandledExceptionRecoverable |
| Methods | Dispose |
| Events | UnhandledException |
Properties
ID
public ScriptId ID { get; }The Sansar Script’s unique ID. This ID is unique among all scripts currently running in a scene. It will change every time the script or scene is started.
Value: ScriptId — Returns ScriptId.Invalid if the ScriptHandle is not initialized with a valid script.
Remarks
Internal.
UnhandledExceptionRecoverable
public bool UnhandledExceptionRecoverable { get; }If true a script can keep running if an unhandled exception is processed by ScriptHandle.UnhandledException.
Value: bool — Boolean indicating if the script may continue running after an unhandled exception occurs.
Remarks
If this is true and the ScriptHandle.UnhandledException event is set and does not throw and exception the script will continue to be scheduled.
Methods
Dispose
public void Dispose()Internal use only
Events
UnhandledException
public event Action<object, Exception> UnhandledExceptionRun by the script scheduler when the invocation of a script event handler or coroutine throws an exception.
Remarks
If ScriptHandle.UnhandledExceptionRecoverable is true then the script may continue running if the handler does not throw an exception. If the handler needs to stop execution of the script it should throw the passed exception. The first argument is either the EventData that was being processed, or the Coroutine that was running when the exception occurred.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.