Header menu logo BaboonAPI

YieldTask<'r> Type

Async operation type

Can be run inside coroutine computation expressions:

coroutine {
  let! assetBundle = openAssetBundleFromFile "mybundle.assetbundle"
  printf $"Loaded {assetBundle.name}"
}
val printf: format: Printf.TextWriterFormat<'T> -> 'T

Instance members

Instance member Description

this.ForEach

Full Usage: this.ForEach

Parameters:
    action : Action<'r> - Consumer that will receive the task's result

Returns: IEnumerator<YieldInstruction>

Attach a callback to this YieldTask which will run with its result

The returned IEnumerator must be yielded to Unity, otherwise the callback will never run.

action : Action<'r>

Consumer that will receive the task's result

Returns: IEnumerator<YieldInstruction>
Example

Usage example within a coroutine callback:

public IEnumerator Start()
{
    var task = Unity.loadAudioClip("sound.ogg", AudioType.OGGVORBIS);
    return task.ForEach(result => Debug.Log("Loaded clip!"));
}
val task: TaskBuilder

this.Select

Full Usage: this.Select

Parameters:
    selector : Func<'r, 'u> - A transformation function to apply to the result of this task

Returns: YieldTask<'u>

Project the result of this YieldTask into a new form

selector : Func<'r, 'u>

A transformation function to apply to the result of this task

Returns: YieldTask<'u>

Type something to start searching.