|Attention||Topic was automatically imported from the old Question2Answer platform.|
Hello! I’ve finally started learning Godot and I am currently trying to figure out the workflow with animations.
My problem is that the animations seems to be very fragile. Consider this:
- I’m creating a
Playerscene. It contains a Sprite and an AnimationPlayer animating the Sprite.
- I need an enemy, so I’m creating an
Enemyscene. It happens, that the enemies need the exact same animation as
Player, so I’m saving the animation I already did for the player as a
walk.tresand load it in the AnimationPlayer of
- I’m realizing I don’t want to use Sprite to represent the enemy after all, so I’m removing the sprite and as soon as I do it, it takes the animation track with it and wipes it from
walk.tres, despite there is still
Playerwhich needs this data to animate its Sprite.
In fact every single character in my game has the exact same animation, it makes sense to hold it in one place, so whenever I want to tweak it, I can just edit the saved
walk.tres file. This works fine, until the animated sprite in any scene gets deleted and with it the animation track with all the keyframes. As soon as the Sprite is deleted its animation track is gone, despite there being others still using this file. If I bring back the Sprite with Ctrl+Z the animation track is back, however if I miss the undo – it’s gone, even if I won’t save the scene and just close it without saving, then reopen the scene in its original form where the original Sprite was still present, the animation track is still gone, because it was just wiped from
walk.tscn the second I clicked delete on the Sprite.
It makes sense, because after all, the animated property no longer exists, so the track has no reference to anything, but only within this one scene – what if there are many others still holding valid Sprites to reference?
I don’t like the fact that I may have hundred different characters using one animation and it just takes one sprite getting deleted from any of them to wipe it from the saved file. Right now it’s not an issue, because my files are all fresh, but I’m 100% sure that in the future I may come back here and realize “oh this sprite is not needed here anymore” and delete it not being aware there is an animation track being tied to it, which will silently wipe the keyframes for dozens other scenes using them.
I assume I fail to understand the relations between resources here. What would be the proper way to store an animation data for many objects to use, without accidentally wiping the resource file?