0
Answered

Superunit as Function: how to have a For Loop inside?

Vong 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

Re: https://support.ludiq.io/communities/5/topics/2549-multiple-macro-superunits-in-the-same-flow-use-the-output-of-the-last

I've been using the workaround of using no control flows for the superunits I intend to use as functions.

However, a bunch of times now I've wanted to use a For Loop inside the function and been stumped.

How would I go about this in 1.4?

Edit: On a side note, under which heading would the mentioned "function" mode feature be in the Bolt 2 roadmap? 

Bolt Version:
v.1.4.1b5
Unity Version:
2018.3.3f1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1
Answered

Hi Aisard!

So functions are not explicitly labeled anywhere on the Bolt 2 roadmap, but we're designing them as part of classes.

As a workaround for the other thread you linked, you can always use a control port in your super unit, then use a Cache unit on the output of the first Super Unit to make sure you control when the value gets cached manually. This would allow you to use For loops inside the unit.