All Questions

Community

D
Syntax3rror

I get error within the Statemachine Script

The Error says,
"Attemt to call funktion 'enter' in base 'null instance' on a null Instance."

I think it is cause by the var state_machine in the Script State, which there Initialy gets set to null, so as I run my game, it tries to call the statemachine script and ends up having an error cause the var state_machine is still set to null.

I have no clue wether thats what causes the error or not nor have I gotten many ideas left how to fix that problem.

Please Help

  • Razoric replied

    The state machine tries to set the starting state variable to the node that's in Initial State. If you did not set the Initial State property, then state is not set and so enter() fails (because state is null.)

    You must set the Initial State property in the inspector.

  • D
    Syntax3rror replied

    Thank you very much for this fast and good answer
    Problem solved :)