Hi everyone,
I'm trying to figure out how to use await
in C#. For example, I would like to run simple tween, wait for it to finish, and then run some more code. I've been experementing with something like this, but have had no luck so far:
var tween = CreateTween();
tween.TweenProperty(panel, "modulate:a", 0, 1).SetTrans(Tween.TransitionType.Sine);
await ToSignal(tween, "finished");
GD.Print("Tween Finished");
I'm getting this error which I don't fully understand, but presumably it's because ToSignal(tween, "finished")
is not returning a Task
?:
CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
I've based my use of ToSignal
on this doc:
Please let me know if you have any suggestions!
Thanks,
d13