[Spine2D] Setting animations based on flag variables

Hi everyone, first time PC user here. I’m testing out spine2D animations and trying to get animations to play based on flags related to character movement (e.g. isOnGround, isMoving, etc.)

My issue is that I’ve naively assumed that conditionally calling setAnimation() in update() would be enough. What happens is that for every update() the animation I want to play is always being started anew, which makes the animation look like it’s stuck on one frame.

Is there a way around this behavior? Say, keep looping the animation until a flag changes value? Though I don’t know how to programmatically detect if a flag has changed.

Any ideas?

Project: https://playcanvas.com/editor/scene/874238