Get Time In State
Get how long the current state has been active, in seconds.
Parameters
| Parameter | Description |
|---|---|
| Time In State | Stores the number of seconds since this state became active. |
What It Does
This action reads the current state's active time and writes it to a Float variable.
Use it when you want logic based on how long the FSM has been in the current state, such as delaying a transition, fading UI over time, or showing a timer on screen.
Example
Use Get Time In State to trigger an event after 3 seconds in a state:
- Run Get Time In State every frame and store the result in
elapsed. - Compare
elapsedto3. - Send an event or transition when the value is greater than or equal to
3.
Notes
- The timer resets each time the FSM enters the state again.
- This measures time spent in the current state, not total game time or time since the FSM started.