Skip to content
Langit Works

Langit Works

Unity Developers, Plugins Creators, Blogger

  • MyInteractionKit
  • MyInteractionKit Tutorials
  • Blog
  • Free Tools and Scripts
  • Explainer Class
  • Contact Support
  • About

Animation Finder in Unity

Posted on August 22, 2024January 13, 2025 By LangitWorkers No Comments on Animation Finder in Unity
Free Scripts

The script I will be sharing with you today is called the Animation List script. If you are wondering what are the animations that exists inside a certain objects, this script will be helpful.

There are two scripts responsible for this.

AnimationFinder.cs

This script gets all the animations from the Animator component of the object. This is the script you apply to the GameObject.

using UnityEngine;

namespace MyInteractionKit
{
    public class AnimationFinder : MonoBehaviour
    {
        [HideInInspector]
        public AnimationClip[] animationClips; // This will hold the list of animation clips
        public Animator animator;

        void OnValidate()
        {
            // Get the Animator component attached to this GameObject
            animator = GetComponent<Animator>();

            if (animator != null)
            {
                // Get the RuntimeAnimatorController associated with the Animator
                RuntimeAnimatorController controller = animator.runtimeAnimatorController;

                if (controller != null)
                {
                    // Assign all animation clips to the public array
                    animationClips = controller.animationClips;
                }
            }
        }
    }
}

AnimationList.cs

This Editor script is responsible for listing the found animations in the Inspector. This should be put in a folder called Editor.

using UnityEngine;

namespace MyInteractionKit
{
    public class AnimationFinder : MonoBehaviour
    {
        [HideInInspector]
        public AnimationClip[] animationClips; // This will hold the list of animation clips
        public Animator animator;

        void OnValidate()
        {
            // Get the Animator component attached to this GameObject
            animator = GetComponent<Animator>();

            if (animator != null)
            {
                // Get the RuntimeAnimatorController associated with the Animator
                RuntimeAnimatorController controller = animator.runtimeAnimatorController;

                if (controller != null)
                {
                    // Assign all animation clips to the public array
                    animationClips = controller.animationClips;
                }
            }
        }
    }
}

Script Usage and Support:

This script is part of the upcoming MyInteractionKit, which will soon be available on the Unity Asset Store. Feel free to use this script as needed, whether it’s for personal projects, learning, or if you’re in a situation where purchasing the full kit isn’t feasible right now.

If you find this helpful and are in a position to do so, I invite you to support the full MyInteractionKit when it becomes available. Your support helps me continue to create and share more tools like this with the community.

Tags: Animation Management Free Unity Scripts Game Development Tools MyInteractionKit Unity Animation Script Unity Animator Unity Editor Scripts

Post navigation

Next Post: How to Setup MyInteractionKit ❯

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Unity Content Design: Crafting Engaging Experiences
  • A conversation about Scriptable Objects and Data Storage
  • Questions on 3D Models for Unity – Part 2
  • Questions on 3D Models for Unity
  • Importing Assets from Unity AssetsStore

Copyright © 2025 Langit Works.

Theme: Oceanly News Dark by ScriptsTown