Hello everyone!
I'm currently working on a project & I have animations where I want to check for the name of the current animation that's playing.
Context
The Issue
The "idea" was that I would have another variable called something like "animation_name" in the "Player.gd" script. However, the issue I'm having is that when I attempt to access the "animation_name", the debug panel prints "null".
Is there a way to get the name's of the animation that's inside the display list in the animation player & display those animation names dynamically using the debug panels?
Thank you for your time!
EDIT: I can kinda make it work by printing the animation names: print(animation_player.current_animation), which isn't exactly what I want.
EDIT2: Removed an unnecessary part of text that was solely there for reference.
So a solution has been provided by aandrewjhaugen over on the GDQuest discord, much appreciated!
Solution
So to Debug what animation is currently playing, the following is needed:
The "onready var current_animation" string variable is declared before any func happens but after (you for paranoid safety) the variable "onready var animation_player" is declared, then use: "current_animation = animation_player.current_animation".
In the screenshot I'm calling for the "current_animation = animation_player.current_animation" in every if-statement but in my use case, it is possible to declare "current_animation = animation_player.current_animation" AFTER all of the if/elif statements.