Property IgnoreCancellation
IgnoreCancellation
Gets or sets a value indicating whether the script should ignore cancellation requests.
When set to true
, calling Cancel()
on the action will not request the script to be cancelled.
This is especially important for scripts running as OnEnter or WhileActive actions. Whenever the trigger is deactivated,
these actions will be Cancel()'led leading to interruption of script flow. This is by design and by default. Setting this flag to True
will change that behavior
Declaration
bool IgnoreCancellation { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The script needs to periodically check the cancellation token to respond to cancellation requests. Scripts that do not check IsCancellationRequested may continue to run beyond the specified maximum execution time.
while (!cancellationToken.IsCancellationRequested)
{
// Perform work here
}
while (true)
{
// Infinite loop, does not check cancellationToken
}
It's crucial for scripts to implement proper cancellation checks to ensure they can be terminated gracefully.