How to create a loop in FlowGraph


This is a very simple question, firstly, I’ll just say, I’m using FlowGraph because it has the code blocks I need, (So I’m not using ScriptCanvas or Lua), but it’s very simple, at the minute, I have some code which when it loads a canvas, it will display the current time of day in a text object. How can I loop this code so that it keeps updating?

This is what it looks like so far:

It’s very simple I know, and if you’re able to help, is there a way to change the format of the Time Of Day too? Because where this code does work, it only says 6.0000 where it would be nice to say 6:00. (I understand this would involve a lot of conversion, but if anyone can help me with the looping at least, that’s fine.)



Hey Danny,

I had a similar problem last year. After a bit of work, I ended up using a timer. :stuck_out_tongue: I think it was because that was the fastest and easiest solution that met my needs – unfortunately, I quickly ran into problems tracking data and not enough time to solve all the problems.

If a timer doesn’t work for you, another option might be to use “recursion” to solve the problem.

Good luck!

The timer node is indeed the way to go. You don’t want to loop it, you want to query it every frame as looping it in a single frame would always yield the same time (and freeze the game for that matter). Regarding conversion, I’m not aware of any builtin way, so as you said you’d have to do it yourself using math.

EDIT: Just tested and script canvas as well as flow graph detect infinite loops and cancel them after a while. Script canvas even tells you about that in the console. I didn’t know that myself :D.