I really want to know if there is a way to define action variables async? Or some alternative method?
public System.Action myAction; public async System.Action myAsyncAction; void Start() { // normal action myAction += () => { Debug.Log("Inject some code in runtime.."); }; // I want something like this that support wait time.. myAsyncAction += () => { await Task.Delay(2000f); Debug.Log("Inject some code in runtime.."); }; }
void, and awaitables return something like a Task if they have no result value, or Task<T> if they have a result value. In either case the Task is the return value, so they aren't void (aren't Actions). Don't strive for ways to await void ;)