#Not sure where the state is initialized "Invalid get index 'name' (on base: 'Nil')"

1 messages · Page 1 of 1 (latest)

glass rose
#

The problem is not the state.gd script and it doesn't have to be attached to any node. It serves as an interface for the actual implementation of your states (Idle, Air, Run, etc.)
That script probably has a line that says: class_name State and your states scripts probably inherit from that with extends State or something similar.

Your problem here is the error in line 11. It basically means that nothing is assigned to the state variable or more specific that it can't find name in nothing.
The statevariable gets initialized as the initial_statevariable. So that one is probably not set yet.
Did you set any state in the inspector for the export variable initial_state?

sinful coral
#

I believe it is set to idle

glass rose
#

Just to be 100% sure: Click on the StateMachine Node, go to the inspector and make a screenshot of what it set as the initial_state variable 😅

sinful coral
#

sorry i had gone to sleep when you responded