Input Coalesce

NeedsLoomis 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 1

I assumed Null Coalesce (and other null options) could be used to handle input ports in macros with nothing connected, but I guess it's only for nullable types or missing variables.

Would be nice to have a way to handle missing inputs!

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

Hi NeedsLoomis!

Thanks for the suggestion. Unfortunately that cannot be implemented. At a fundamental level, the graph connections are considered to be static, "compile-time" constants. This is something we rely on at multiple levels. The graph may not be aware of its connection state at runtime (that would be the equivalent of graph-reflection, which Bolt does not support).

Basically, think of it like a method call. The language (C#) has to know in advance that a parameter exists and will be passed, it cannot check that it was passed at runtime only. Supplying default/null values is the common pattern to deal with this case.