Force state transition

cosmonaut 4 years ago updated by Eric Welwood 4 years ago 7

Hi there,

We're setting up some character behavior using Bolt. It's been great so far but we have one slight organization issue. We are using a utility AI to drive the high-level character state. As a result, when using Bolt, the top-level state machine for the character is a huge mess of transitions because we need to be able to transition from any state to any other state at any time. It's very brittle when adding new states because things can unexpectedly break if we forget a single transition. 

We tried to solve this by switching the state macro on the character at runtime but it looks like this isn't supported.

Is there some other way to perform these high-level state transitions that need to all be able to move between each other?

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

Just to clarify, something like Mecanim's Any State node would work well here.

Pending Review

Hi Cosmonaut!

Conceptually, transitions are the way to go to ensure proper flow in FSMs, which is why there's no built-in unit to do what you want. Additionally, since there's no way to uniquely identify a state within Bolt, there's no way to target one at the API level to force a transition.

Do you have an example of how this is handled in another visual scripting solution?

(I'm working with Cosmonaut) the unity mechanim system solves this using the "any state" node


However, a preferable solution for us would be to actually swap out the state machine on the bolt state machine component during runtime. Is this possible?

Actually, an Any State node would be the preferred solution. This is possible in the NodeCanvas system on the Asset Store.

Beautiful. Thanks!

PlayMaker has SetState(string) which forcefully sets the state. But PlayMaker enforces unique state names.