Under Review

Input For State Machine Transitions

John Turner 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 4

It would be useful to supply input values for state machine transitions. 

Right now if I wish to trigger a state transition from code using a custom event I need a followup event supplying data for that state. 

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

Especially since it shows the UI for input and output variables like in flows

Another option is to read the variables from object variables but that causes other problems

This would be for me a killer feature. I want to use the state machine to handle highlighting and object enabling/disabling for tutorials and intended to use the input variables to handle the object reference to the highlighted object and such. Since it has the UI to enable such input and set the input in the graph I assumed it'd work.

Edit: I looked more into and there is no much of a need to add that feature because with some minor refactoring from the states to Flow Macros made it work what I planned to do for today. The inconsistent UI at this point made it more confusing than it should be.

Under Review

This is something I'd like to look into, but it requires a solid rethinking of the nature of state graphs, and whether data exists at the state graph level in terms of design.

In the mean time, the workaround is to create a transition and use a super unit macro inside of it, which is your "real" transition. This way, you can specify inputs directly from there, and even dynamically fetched/calculated ones. This is what is done in the Enemy AI part of the platformer tutorial, for example.