kubecz3k / FiniteStateMachine

FSM plugin for Godot
MIT License
116 stars 22 forks source link

Nested FSM don't work #2

Open MrGreenTea opened 7 years ago

MrGreenTea commented 7 years ago

I am trying to create a menu with this plugin and it works really good. But when I try to create a sub-menu, changing states does not work. I have created a minimal example of this for you to check out: FSM_testing.tar.gz If you need more info, I'd be glad to assist.

kubecz3k commented 7 years ago

Thank you a lot! Basically fsm is never expecting to be removed from scene tree (only states and transitions are prepared for this) But you have couple options to make it work, the fast one: If you uncheck "only active state on the scene" it in ~both~ parent fsm it will work fine.

If you need this option you still can! Second way: make setup similar to how it's on this screen: subfsm_screen (notice script as well as inspector setup of sub-fsm (update mode, manual init))

MrGreenTea commented 7 years ago

Thanks a lot, the second way worked very well. Could be something to look into, as it's a bit unintuitive.

kubecz3k commented 7 years ago

I think in next update I will make 'only active state on the scene' off by default. Since it has also other implications that user can not be aware of and this option don't need to be on at all most of the time anyway. This option is there mainly because it can increase performance of your program (like remove from the scene tree rays/areas that are not needed in different states (thats how I'm using it)) Or to have for example different sprites in different states and not code sprite changes or something.

But I think it's there more for people who are aware of what FSM will do if you check it (or at least they will think about that for a second before checking).

kubecz3k commented 7 years ago

@MrGreenTea also one more thing, each state have it's own scene file. It's there for user comfort, you can use it if you want (mean by putting all the child nodes of first level SECOND state inside SECOND scene) (just an info)

kubecz3k commented 7 years ago

Actually I will open it for now. It should be possible to fix this concrete case.