Closed ratozumbi closed 6 years ago
Better thinking, the right behavior should be that FMS can't allow a new transitions from a state using a script already used to transit from that state
Hello. Thank you for your report. Can't take a look at it right now (will need to reproduce to understand), but I promise I will in couple days.
Oh I get what you are trying to do. This is the situation
+----------+
+--------+SOME_STATE+--------+
| +----------+ |
| |
| v
v
onTransition onTheSameTransition
+ +
| |
| |
v v
+----+------+ +-------+---------+
|OTHER_STATE| |THIRD_OTHER_STATE|
+-----------+ +-----------------+
It's prohibited for Finite State Machines to be at the same time in multiple states (FSM are simpler than a Petri net). Your FSM can be only in one well defined state at any given time. And in this implementation transitions have different priority that's determined by their order in scene tree (higher in tree == more priority).
You might want to check http://www.gameprogrammingpatterns.com/state.html (ensure you understand the concept, then what you might need for your particular use case might be here: http://www.gameprogrammingpatterns.com/state.html#concurrent-state-machines).
Also to better understand what's happening you can use 'debug' checkbox in your FSM node to always see in what state your object is and what transition is responsible for that.
Steps to replicate
0) Create FSM2D node 1) Create ANewState from FSM inspector 2) Create onTransition from ANewState 3) Create OtherState from onTrasition 4) Create ThirdOtherState from FSM inspector 5) Create onTransitionCopy from ANewState selecting "Choose existing" and select the same script that transits to OtherState 6) Link onTransitionCopy withThirdOtherState
Expected: 2 states running or an error message for the user What happens: only first linked state runs (the OtherState in this exemple)
Furthermore, even if the link from ANewState and onTransition is deleted (X) the onTransitionCopy will not work and FSM will not go to ThirdOtherState, it will stay in ANewState