assert that initial state exists

This commit is contained in:
yuki 2025-11-19 14:32:00 -03:00
parent 9e72492dc7
commit 41cc35576d

View file

@ -10,6 +10,7 @@ class_name StateMachine extends Node
func _ready() -> void: func _ready() -> void:
assert(state != null, "initial state is null")
for state_node: State in find_children("*", "State"): for state_node: State in find_children("*", "State"):
# fixes duplicate connections (not sure why) # fixes duplicate connections (not sure why)
if not state_node.finished.is_connected(_transition_to_next_state): if not state_node.finished.is_connected(_transition_to_next_state):