Locals in flow macros do not disambiguate across multiple instances of same macro

Daniel Robbins 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 2
  1. Created a Flow Macro to output a random character (string). If I chain together a few of these same Flow Macros, though, the value of each call is overridden by the last one in the sequence. Each Flow Macro generates a different value but when concatenated together, they all end up being the same value. See the debug output to the console:
  2. I then created a Flow Function (in the same class) and it worked correctly:
  3. Next I decided to create a version of this Flow Function in a different, "Helper" class, that I could use from other classes, without requiring duplication. When I did that, though, I received an error, "...doesn't own graph..."
Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
.NET Standard 2.0
Bolt 2
Pending Review

Hi Daniel,

Thanks for the report. Looks like a bug indeed (or two!). I'll look into them.


Hi Daniel,

I've had a chance to look into this and I can confirm the issue on my end.

What I believe is happening is that Bolt checks for existing locals by port-uniqueness, but the "same" port is being shared across all three macro instances. 

I'll have to be careful fixing this, but I believe the fix is simply to uniquely identify port locals by their graph reference stack as well. This is not trivial to do without generating lots of garbage though.