Pending Review

2.0.0a7 Macro Graph type doesn't generate any C# in code preview and often freezes Unity after pressing Play

Ex-Crow 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 3

No C# preview code in a Macro Graph:

Unity froze twice while trying to run this graph with Macro in it: https://imgur.com/t8yOma5 It doesn't happen every time though. 

Macro graph: https://imgur.com/ozrFPA2

EDIT: Managed to freeze Unity again, just press Play with the DoSomething graph on an object multiple times until it happens. 

And again. Freeze happens on Loading Unit Options step.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Need More Information

Hi TowerCrow,

Thanks for the report.

The fact that flow macros don't generate code is by design. Macros don't do anything until they're used somewhere else (in a behaviour or in a function). When they do get used, the code they would generate gets inlined with the inputs and outputs replaced by the container's connections. This is part of what makes macros so powerful: they're not a C# construct per se, they're a "pre-compiler" construct!

Regarding the freeze, do you get it only on macro graph or does pressing play/pause repeatedly also freeze in other contexts? It seems like a deadlock, but I fail to see why a specific graph type would cause it.

I have only seen the freeze with a macro graph type being called like in the images above. The freeze has not happened in any other scenario while working with or without Bolt 2. These are the first instances of freezing I've come across which is why I think it might be the Macro Graph type. 

Pending Review

OK, I'll try to get it to happen myself specifically with a macro.