Godot Version
4.2.1.stable.official
Question
How to instance the same animation multiple times?
Because 1 AnimationPlayer cannot play multiple animations at the same time, I decided I would save an AnimationPlayer node as a scene and then load it, instantiate it and add it as a child from script each time I want to run one of its animations. (So, there’s one AnimationPlayer node in the main scene that calls methods from its own script to instance this other AnimationPlayer node scene.) That was I can have multiple instances of the same animation without stepping on each others toes.
It seemed to work, but then I realized I should queue_free() the instanced AnimationPlayer after the animation ends, so I opened the saved scene from the FileSystem tab and added a Call Method track to each animation to call the animation player’s own queue_free() method. But now the problem is that the AnimationPlayer node is in its own scene tab, so it cannot see the node its animations are refering to (it’s supposed to call methods from a node in the parent scene) and I’m getting 200 error messages about that.
Can I not have an AnimationPlayer in its own scene that references a node in a parent scene? In script I reference nodes from other scenes a lot of times without any problems. What is the “normal” way to instantiate animations if not saving an AnimationPlayer node as a scene?
Thanks for reading.