Debugging what animation is Playing in Animation Player

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.


  1. To debug, I'm basing the debugging on what's taught in "The Run state and using the DebugPanel" in the tutorial course: "Code a 2D Platform Game Character with Godot".
  2. The "Animation Player" is located in a scene called "PlayerSkin.tscn" & the "PlayerSkin" is a child object of the scene "Player.tscn".
  3. In "Player.gd", I have a variable, a reference to the Animation Player called: "onready var animation_player: AnimationPlayer = $PlayerSkin/AnimationPlayer".

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!

Link to Project

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.

  • f
    functionSam replied

    So a solution has been provided by aandrewjhaugen over on the GDQuest discord, much appreciated!


    So to Debug what animation is currently playing, the following is needed:

    1. a reference to the Animation Player called for example (in my case): onready var animation_player AnimationPlayer = $PlayerSkin/AnimationPlayer.
    2. A string variable that's empty, for example: onready var current_animation: String = "".
    3. In your level scene, create a duplicate of the Debug Panel that was created in the tutorial: "The Run state and using the DebugPanel" in the tutorial course: "Code a 2D Platform Game Character with Godot".
    4. You now want to use the "current_animation" variable somewhere, in my case I use it in _physics_process:


    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.