Animation finished signal not triggering

Godot Version

4.2.1

Question

Hello all, I have an issue with the animation_finished(anim_name) signal
For some reason it won’t trigger and i don’t know why. I’ve encountered this issue before but circumvented it by using timers that match the animation time but i feel like this is bad practice to just keep adding timers. Anyway here is the code:

extends Player_State

@export var ground_state : Player_State
@export var Usable_ability_node : String = "Usable_ability"
@export var run_animation_node : String = "Run"


# current ability
func on_enter():
	var ability1 = character.current_ability.instantiate()
	character.add_sibling(ability1) # Adds to same parent as player
	var ability1_offset = Vector2i(-100,0)
	ability1.global_position = character.global_position + Vector2(ability1_offset)
	print("Ability added: ", ability1)



# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
	pass


func _on_animation_player_animation_finished(anim_name):
	if anim_name == Usable_ability_node:
		playback.travel(run_animation_node)
		next_state = ground_state

The string is correct in everywhere it is used

Any and all help is appreciated :slight_smile:

Are you using it inside an AnimationTree? I don’t think the AnimationPlayer fires signals when using its Animations inside a AnimationTree

Either way, you could add call method tracks to your animations instead.

Are you using it inside an AnimationTree? I don’t think the AnimationPlayer fires signals when using its Animations inside a AnimationTree

I think so? this is my node setup, but the signal is emitted from the animationplayer. Maybe it should be emitted from the animation tree?

Solution: I emitted the signal from the animationplayer when it should’ve been emitted from the animation tree

Thanks for the help :slight_smile: