0
Not a Bug

Timer and Cooldown don't action On Exit State

Von Betelgeuse 9 months ago updated by Lazlo Bonin (Lead Developer) 9 months ago 4



None of these above debugs return, I can see On Exit State being triggered in the inspector and Timer light up, but it does not action. Same with Cooldown. I have tried setting Coroutine bool to true and false but there's no difference.

Strangely this issue only appears On Exit State, On Enter State works perfectly fine :|

Bolt Version:
1.4.1
Unity Version:
2018.3.0f2
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hi Von Betelgeuse,

That is because all events in a state stop listening after a state is exited, so that Timer effectively stops listening instantly after having been started.

Can you put it inside the On Enter State of the next state instead?

Thanks for taking a look.

Putting it in On Enter State doesn't really work for what I need (crossfading between old and new UI elements) but I can write a custom coroutine to use instead.

+1

I'm afraid that might not work either, IIRC coroutines are stopped when exiting the active state.

In case it doesn't work, I would suggest triggering the time or coroutine on an always-active state with a Custom Event.