Anyone using events in Spine effectively?
We’ve noticed some odd results using the examples provided e.g. spineboy.
The following is happening which is unexpected:
- The first time animation is set does not trigger onStart but subsequent animation setting does.
- If loop is true, onComplete fires at the start of an animation.
Using Build 2016.2883 for Windows.
To drill down to specifics, here is some of the code with comments:
-- Events state.onStart = function (trackIndex) print(trackIndex.." start: "..state:getCurrent(trackIndex).animation.name) end state.onComplete = function (trackIndex, loopCount) print(trackIndex.." complete: "..state:getCurrent(trackIndex).animation.name..", "..loopCount) end -- Animation calls state:setAnimationByName(0, "walk", true) -- onStart does NOT print -- onComplete prints immediately when onStart is expected with: 0 complete: walk, 0 -- onComplete fires as expected at the end of each loop state:addAnimationByName(0, "jump", false, 3) -- onStart does print for jump: 0 start: jump -- onComplete does NOT print but would have expected it to. state:addAnimationByName(0, "run", true, 0) -- onStart does print for run: 0 start: run -- onComplete prints immediately after onStart with: 0 complete: run, 0 -- onComplete fires as expected at the end of each loop.