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..");
};
}
I've used Func<Task> in the past. EG:
Func<Task> asyncMethod = async () =>
{
await Task.Delay(1000);
Console.WriteLine("done here");
};
await asyncMethod();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With