derkork / godot-statecharts

A state charts extension for Godot 4
MIT License
734 stars 35 forks source link

Stack overflow (stack size: 1024). Check for infinite recursion in your script. #42

Closed aberizrihays closed 10 months ago

aberizrihays commented 10 months ago

Setting up a chart like the one in the demo video throws this error and it points to this code (state.gd / 281):

func _toggle_processing(active:bool):
    set_process(active and _has_connections(state_processing))
    set_physics_process(active and _has_connections(state_physics_processing))
    set_process_input(active and _has_connections(state_input))
    set_process_unhandled_input(active and _has_connections(state_unhandled_input))

Disconnecting all signals does nothing. Just the existence of the thing in my scene seems to be making it rather cranky.

Unsure if related: it doesn't always seem to recognize when I have set a default state or when a node has a child and it will still give me a little warning that says I need to select a state.

derkork commented 10 months ago

Infinite recursion usually happens when you have unguarded, immediate (no event set) transitions that form a circle. E.g state A immediately transitions to B and B immediately transitions back to A. Please check that your transitions have either an event set or have a guard that prevents them from triggering immediately. If you still encounter issues, please post your tree, ideally as tscn file so I can have a look at it.Thanks!

aberizrihays commented 10 months ago

It works now. Thank you :)

derkork commented 10 months ago

Awesome! Thanks for reporting back!