I have an entity with an animation that doesn’t loop, and is not set to activate when the scene starts. I just need this to play on demand when I need it.
according to this page, i should be able to call entity.anim.play() to get the AnimComponent to start
the problem is, the API and the debugger disagree with that page. entity.anim.play() throws “entity.anim.play() is not a function” in the debugger and the API for AnimComponent doesn’t list play() as a function
So how am I supposed to set off an animation that just needs to fire when I tell it to in script? The entity just needs to stay at the initial resting state until I tell it to go.
It seems that the API does not exist. I checked the API page, but I couldn’t find it.
If you are using an Anim State Graph with an animation, you can try to do something like below.
I am aware that it doens’t exist, that’s what i was pointing out: that the tutorial docs and the API disagree
Also I also tried the code you stated, and that doesn’t work either
Thanks, maybe @will can take a look at this.
Can you share a sample project so someone can take a look?
I found out that you have to use the
playing API to activate the component at runtime.
entity.anim.playing = true;