+4
Completed

Delay units

Lazlo Bonin (Lead Developer) 2 years ago updated by NeedsLoomis 2 years ago 9

A simple delay unit should be added to delay execution by a certain amount of seconds.

Implementation details are important here. The delayed code will probably run in a coroutine, but nested coroutines or delayed loops will not be supported, as they add a lot of complexity to the flow. 

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

As in On Start > Do Something > Wait 3 Seconds > Do Something else?

+1

Yes, for example! Any control input on the left and any control output on the right.

Really great idea! This was also one of the earlier things I tried figuring out with Bolt using state graphs, but a one off node is even better. Cheers!

+2

Updating this idea with all the feedback from the community.

I will be adding (back*) all types of wait for the next version:

  • Wait for seconds
  • Wait for seconds (unscaled time)
  • Wait for end of frame
  • Wait for next frame
  • Wait until
  • Wait while

Why am I saying adding back? Because these units were already in beta versions of Bolt, but I decided to remove them for the following reasons:

  • They do not play nice with loops. You can wait in a loop, but it will not delay the execution of the next iteration.
  • They do not support nesting (nested coroutines). You can chain them, but they create a new separate coroutine each time. 
  • They cannot be cancelled unless the parent object is destroyed.

These are issues that will remain, because fixing them would require rethinking most of the control flow code and visual workflow. However, seeing how useful these wait units can be even with these issues, I think they're worth adding back.

+4
Completed (Unreleased)

Done for next update! :)

+2

Nice!  Now I can toss my overly complex delay macros :D