Cannot read property 'animation' of undefined

The same code works on another object but not on this, im probably doing a big mistake somewhere but i cannot see? does anyone know where the issue would be ? I have animation component set on

image

image

Hi @smokys,

Your best friend here is the browser debugging tools, with the simplest one being the console.log() method.

Use that to print to the console the value of the variables/properties in question and see what’s the issue, like:

console.log(state);
// or
console.log(states[state]);

From there work your way up finding out why they are undefined, since those are project settings variables not something related with the Playcanvas API.

1 Like

Oh well, i have noticed the issie now, its because in initialize function i was calling this.setState(‘standing’) while it should be this.setState(‘idle’)

I hate this issues due to inattention