Class AsyncHelper
This class should be used for code that needs to run over multiple frames.
Implements
Inherited Members
Namespace: IdleKit.Core
Assembly: cs.temp.dll.dll
Syntax
public class AsyncHelper : IInjectable
Fields
_coroutineLookup
Declaration
protected readonly Dictionary<object, AsyncHelper.CoroutineData> _coroutineLookup
Field Value
Type | Description |
---|---|
Dictionary<Object, AsyncHelper.CoroutineData> |
_coroutineRunner
Declaration
protected AsyncHelper.CoroutineRunner _coroutineRunner
Field Value
Type | Description |
---|---|
AsyncHelper.CoroutineRunner |
Methods
Cleanup()
Cleanup the AsyncHelper including the IdleKit.Core.Coroutines and the UnityEngine.GameObject that houses the AsyncHelper.CoroutineRunner.
It is important that this gets called before the AsyncHelper is released.
Declaration
public virtual void Cleanup()
CreateCoroutineRunner()
Declaration
protected virtual void CreateCoroutineRunner()
Inject(IResolver)
Declaration
public virtual void Inject(IResolver resolver)
Parameters
Type | Name | Description |
---|---|---|
IResolver | resolver |
StartAsyncOperation(Object, IEnumerator)
Starts an asynchronous operation and caches it under a key.
Declaration
public virtual void StartAsyncOperation(object key, IEnumerator enumerator)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key to store this operation under. Can be used to stop it later. |
IEnumerator | enumerator | The method to run asynchronously. |
StopAllAsyncOperations()
Stops all currently running asynchronous operations.
Declaration
public virtual void StopAllAsyncOperations()
StopAsyncOperation(Object)
Stops an asynchronous operation cached under a specific key.
Declaration
public virtual void StopAsyncOperation(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key for the operation to stop if it is running. |
WrappedEnumerator(Object, IEnumerator)
This allows coroutines to automatically be removed once they are finished. Infinitely looping coroutines will still need to be removed manually.
Declaration
protected virtual IEnumerator WrappedEnumerator(object key, IEnumerator enumerator)
Parameters
Type | Name | Description |
---|---|---|
Object | key | |
IEnumerator | enumerator |
Returns
Type | Description |
---|---|
IEnumerator |