Instantiated scene with an animation player duplicates play at the same time

Godot Version

4.4.1

Question

I have an animation player on a scene(Its a spotlight that turns on and off using the animation) that I instantiate and duplicate in another scene(Level scene).
through that Level scene, I want to activate the same animation on the spotlight duplicates in sequence (i.e., one instance plays, then after a delay, another plays, and so fourth)
but every time, I play the animation player in one of the instances it plays in all of them at the same time.
does someone know how can I separate them so each of the instances has a unique animation player?
I tried to make the animation players unique, it still does not work.. I even made a script that changes every node that is used in the animation to have a different suffix (spotlight0..1..2 etc.) and then changed every animation track path to match the new name, still does not work XD
Should I just work with Tweens?
any ideas will be very appreciated, I’m stuck on this problem for way too long, its not even a main part of my game, its just aesthetics XD
Thanks anyways ~ Orin :grin:

I had pretty much the same problem before and got no useful information.

I just gave up and ended up using a different approach that didn’t use AnimationPlayers. I’m not sure why this happens, as it doesn’t appear to be documented behavior.

1 Like

Could you post more information? Scripts, scenes structure, the animation,…? That should not happen.

Each SpotLight has an AnimationPlayer that turns on and off its visible property:

And a function that plays the animation.

Here’s the main script:

extends Node


func _input(event: InputEvent) -> void:
	if event.is_action_pressed(&"ui_accept"):
		$TestSpotlightAnimationSpotlight.play()
		await get_tree().create_timer(1).timeout
		$TestSpotlightAnimationSpotlight2.play()
		await get_tree().create_timer(1).timeout
		$TestSpotlightAnimationSpotlight3.play()
		await get_tree().create_timer(1).timeout
		$TestSpotlightAnimationSpotlight4.play()
		await get_tree().create_timer(1).timeout