Loading SpriteFrames of AnimatedSprite2D in Code

Godot Version

Godot 4.3

Question

Hi all, Godot beginner here and having trouble loading and unloading SpriteFrames in my code. The documentation says that I’m able to “load, edit, clear, make unique and save the states” of the SpriteFrames resource, but I see no method of doing this – the methods listed in the documentation don’t include a function to load SpriteFrames e.g. using the path of the file or something.

I’m probably missing something blatantly obvious, but I have no idea where to find the answer. How do I do this?

you have to load them from a file yourself and then you can add them to the spriteframes

To anyone in the future, here’s the code that worked for me:

$AnimatedSprite2D.sprite_frames = load(“animation”)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.