• Godot Help
  • AnimationPlayer function not being called if key at end of track

I'm having some trouble with an animation I'm creating where a function call is not being made if I place its key toward the end of the animation. This AnimationPlayer is called from within the state machine of an AnimationTree (the Explode node). Anyhow, if I put this function call at the .3 second mark, it gets called every time. If I put it at .6 seconds (the end of the clip), it only gets called about 20% of the time. It will often get dropped if I put it at .5 seconds too. Padding the animation by adding blank frames at the end does not fix the not-being-called problem.

Is there a way I can get it to always be called?


    kitfox forgive me if I don't understand - are you using the _on_AnimationPlayer_finished signal or did you just put a function at the end of the animationPlayer? Because the former is how I would do it. Just connect the signal in the AnimationPlayer to the function you need. That's what it's for.

    Easy answer: the animation ends at the same time the function is called, so it doesn't call.
    Also curious what those 13 debugger messages are. If it's "standalone expression," then that's your problem for sure.

    Using the _on_AnimationPlayer_finished won't work because I'm using an AnimationTree to mange my state, not the raw AnimationPlayer. Also, I'm encountering this even if the function call is moved to slightly earlier in the animation. I have to move it all the way back to the half way mark to be confident it will be called. Also, I feel the function ought to be called even if it is the last frame.

    Those warnings are mostly Godot complaining about parameters that are never used.

      kitfox Those warnings are mostly Godot complaining about parameters that are never used.

      Yes, also if it's yellow it should only be warnings there I think. And red if errors, but maybe I misrecall.