PackedScene w/ AnimationTree running animation on ALL sprites

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pcanella

Hello all, I’m using the latest 4.0 stable build and am having some trouble with AnimationPlayer/AnimationTree and PackedScenes.

Basically, what I’m doing is in my initial GameLevel.gd ready function, I am adding a bunch of PackedScenes, (which is preloaded). Like so:

var thisPlayerLoad = preload("res://Characters/player_cat.tscn")`
func _ready():

	for item in some_team.roster:
		# place players

		var this_player_on_ice = thisPlayerLoad.instantiate(PackedScene.GEN_EDIT_STATE_MAIN)
		var label = this_player_on_ice.get_node("playerLabel")
		label.text = item.last_name
		if (item.current_line == 1):
			add_child(this_player_on_ice)

and "res://Characters/player_cat.tscn" has an AnimationPlayer and an AnimationTree. These all work individually when I instantiate through the GUI, but not via a PackedScene. (Screenshot attached)

The problem is, whenever I run an animation on my “selected” player (which is one of those PackedScenes), they ALL do the same animation. I’ve tried to duplicate the AnimationTree and AnimationPlayer and re-add them to the instantiated PackedScene, but nothing has really worked.

Is there any workaround for this that I can do?

enter image description here