Handling missing inputs

CaptainTuna 2 years ago updated 2 years ago 2


I'm making a super unit with a bool input. I want the super unit to do something specific if the input is missing. This is what I've tried:

The problem is that I get the following error when I trigger the On Trigger Event with the "bool" input missing:

InvalidOperationException: Exiting recursion stack in a non-consecutive order:
Provided: Bolt.ControlOutput / Expected: Bolt.ValueOutput

The "aaa" log message also appears in the console.

I'm not sure what exactly I'm doing wrong. I tried googling the error but I didn't find anything specific to my case.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by CaptainTuna 2 years ago

Hi CaptainTuna,

This might be an underlying bug in the handling of exceptions on the graph stack, but overall, I wouldn't advise using this technique. Once Bolt 2.x gets released with code generation, MissingValuePortExceptions will never be thrown. There is a "compile-time" problem with your graph is missing an input, not a "runtime" problem. There is no support for detecting and fixing that at runtime.

You can use default values on input ports so that the top level graph doesn't have to specify a connection for your port, however. Simply check the "Default Value" checkbox on your bool input definition. This will make it impossible for the port to ever be missing.

Thanks for the detailed answer Lazlo! :)