Class Async
Class Async.
Namespace: UnityEngine.Industrial.Configuring.Utils
Syntax
public static class Async
Methods
CheckExceptions()
This will report whatever exception from the last-run coroutine (using RunThrowingIterator(enumerator)). The error message will be from the correct exception, but the user will need to find the inner exception message to see where the error originated from. Not ideal but better then nothing.
Declaration
public static void CheckExceptions()
Exceptions
Type | Condition |
---|---|
Exception |
Run(IEnumerator)
Keeps last error that you can then check for
Declaration
public static IEnumerator Run(IEnumerator enumerator)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator | enumerator | The enumerator. |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator. |
Run(IEnumerator, Action<Exception>)
Run an iterator function that might throw an exception. Call the callback with the exception if it does or null if it finishes without throwing an exception.
Declaration
public static IEnumerator Run(IEnumerator enumerator, Action<Exception> done)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator | enumerator | Iterator function to run |
Action<Exception> | done | Callback to call when the iterator has thrown an exception or finished. The thrown exception or null is passed as the parameter. |
Returns
Type | Description |
---|---|
IEnumerator | An enumerator that runs the given enumerator |
StartThrowingCoroutine(MonoBehaviour, IEnumerator, Action<Exception>)
Start a coroutine that might throw an exception. Call the callback with the exception if it does or null if it finishes without throwing an exception.
Declaration
public static Coroutine StartThrowingCoroutine(this MonoBehaviour monoBehaviour, IEnumerator enumerator, Action<Exception> done)
Parameters
Type | Name | Description |
---|---|---|
MonoBehaviour | monoBehaviour | MonoBehaviour to start the coroutine on |
IEnumerator | enumerator | Iterator function to run as the coroutine |
Action<Exception> | done | Callback to call when the coroutine has thrown an exception or finished. The thrown exception or null is passed as the parameter. |
Returns
Type | Description |
---|---|
Coroutine | The started coroutine |
Wait(Func<Boolean>, Int32)
Waits the specified predicate.
Declaration
public static IEnumerator Wait(Func<bool> predicate, int maxCount = 100)
Parameters
Type | Name | Description |
---|---|---|
Func<Boolean> | predicate | The predicate. |
Int32 | maxCount | The maximum count. |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator. |
Yield(Int32)
Yields the specified count.
Declaration
public static IEnumerator Yield(int count = 1)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | The count. |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator. |