0 votes


I am using Godot as a live presentation tool. It works quite well, but my script only goes forward and backwards, now I want to refine it a little so it handles exiting and the end of animation_list.

After getanimationlist(), I need to know how many animations there are inside (getting the highest index would be equally helpful)

I suppose there's a built-in method to do so, but I haven't found it yet. Any advice?

Thanks. :D

in Engine by (372 points)
edited by

1 Answer

0 votes
Best answer

get_animation_list() returns a StringArray, you can simply call size() on it:

var number_of_animations = my_animation_player.get_animation_list().size()
var last_index = number_of_animations - 1
by (1,090 points)
selected by

Excelent. I completely forgot about that, I feel kind of dumb now. :'v

Where can I find a list to those calls you can make on objects? like size(), I know 2 or 3 more. Where can I find them listed?

Marking this as solved. Thanks for your reply. :D

At the top of the script editor there are two buttons, "Classes" and "Search Help":

Class reference buttons

"Classes" brings up a (searchable) list of all classes. Double click one to see a list of its methods and constants.

"Search Help" lets you search for classes, functions and constants.

You can also read the same reference in Godot's online documentation: http://docs.godotengine.org/en/latest/classes/_classes.html

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.