AnimationEvents not triggered

Hi guys,

I followed the documentation on animationEvents like this:

private func onAnimationCompleted(_ event:
    AnimationEvents.PlaybackCompleted) {
        print("EVENT ENDED")
}
var anim1 = FromToByAnimation(by: Transform(translation: [3, 0, 0]), duration: 3, bindTarget: .transform)

let animationResource = try! AnimationResource.generate(with: anim1)

// Pass the animation to an entity and get a controller.
entity.playAnimation(named: animationName, transitionDuration: 0.0)

entitySubscription = view.scene.publisher(for:
    AnimationEvents.PlaybackCompleted.self, on: entity)
        .sink(receiveValue: onAnimationCompleted)

I never get a print after the animation ended. Nor any other code is run that I put into the completion handler.

What am I missing/doing wrong?

Greetings Gabe

AnimationEvents not triggered
 
 
Q