So I want to call a method about every 2 seconds (spawnInterval), which spawns an obstacle. In unity I could do this with a coroutine and Waitforseconds, but I’m not sure how I can do that here on Flax. I’m pretty sure I could have also done InvokeRepeating() with unity, but none of these methods seem to be working well for me. Is there an easy way of doing this on Flax?
We don’t have anything like Coroutines
but you can use async tasks:
to run code asynchronously (and use Scripting.InvokeOnUpdate(() => {}).
to do sth on a main thread).
In Visual Scripts we have Delay
node to insert delays between chunks of code.
1 Like