How to assign animation only to one instance?

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

I have several instances, each with its own AnimationPlayer, a set of animations and a script that plays animation depending on the direction instance is moving to. But when I load the game it seems like AnimationPlayer.set_assigned_animation() command is shared between all of the instances instead of working for those individually. Is there a way to make current animation unique for instances?

It shouldn’t be shared unless they all have the same script. You should be able to reference each instance separately.

instance.AnimationPlayer.set_assigned_animation(value)
instance2.AnimationPlayer.set_assigned_animation(value)
etc...

Magso | 2019-11-12 22:31

They do have the same script, however variables and animation player resources are separate.

hello_world | 2019-11-15 14:32