On Enter State / On Exit State not firing recursively

Corjn 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 8

Hey, I'm having this issue that was not here with 1.3 (updated to 1.4)

I'm using a + = custom flow macro who will reset my custom time float when entering.The problem is that if a place this macro in a flow inside a state machine, the "on enter state" will fire only once. 

Is that normal ? 

Thanks in advance for the help, 


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

This is making the job for what I want, but the "on enter state" not firing when re - entering a state still seems weird to me (otherwise I would use "Start")

Also, I'm having the same issue with the replacement of "On Timer Elapsed". If I use a "Wait" in a transition, the timer will not reset if the transition exit. I have to use a "Timer" instead with a "On exit State". 

Pending Review

Hi Corjn!

I'm sorry, I don't fully understand the issue here.

Is your problem that Once doesn't automatically reset when exiting the state?

If so, that is by design. The data of the Once node persists across state entry or exit. You are using the right approach to reset it manually on exit.

Hey, thanks for the feedback, 

It's not about the Once node. This one actually solve my issue, but does not feels intuituve, that's why i'm making this theard. I actually have two issues, or things that I think worked better with 1.3.
Sorry it was not very clear, I had the issues making a game jam with the new version of Bolt :)

My issues are : 

First one : 

-Make a flow macro with a "on enter state"
-Put this macro inside a state machine
-With 1.3 : on enter state in fired every time the state where my macro is, is entered / With 1.4 : on enter state will not fire at all inside a flow macro inside a state graph. 

The second one : 

-If I use a "Wait" in a transition for a state machine, the timer will not reset if the transition exit and will trigger the transition. (this is where "once" solve the issue because he cancels the timer on exiting sate) 

The second one is actually really hard to put by text, so I'm making you a macro for both, it will be easier ! 



Thanks for the explanation, I think I understand now!

So basically:

  1. On Enter State is no longer recursively triggering in super units
  2. Asynchronous units like Wait or Timer do not get cancelled on On Exit State

These are both things that are fixable, but I'll have to do some design & testing work and ensure we can get those working in generated C# with Andy as well.

Yes, that's exactly it ! Thanks

Fixed in Next Version

Hey Corjn! So I fixed the recursion issue for v.1.4.0f6. It's actually the smartest it's been in Bolt so far, I think.

On Enter State and On Exit State events will now trickle down recursively to all Super Units, but not to State Units or Super States, which would be confusing. Basically, you'll get an OES event whenever the first Flow State ancestor is entered or exited, but not when further Flow State ancestors are entered or exited.

The question of coroutines is a bit trickier. If I stopped coroutines when a graph stops listening, there would be no way of continuing a coroutine afterwards. But it could be a better default behaviour than what's currently in place, e.g. coroutines having be manually stopped on stop listening. I'll have to think a bit!