Async Await with C# Task
CS
// C#
public class Foo : MonoBehaviour {
public async Task<string> GetAsyncString() {
await Task.Delay(1000);
return "GetAsyncString";
}
public async Task DoAsyncMethod() {
await Task.Delay(1000);
print("DoAsyncMethod");
}
}
TS
// TS
var foo = require("foo")
async function test() {
const text = await foo.GetAsyncString()
log(text)
await foo.DoAsyncMethod()
}
test()