UsefFarahmand / Animator-Parameter-Extractor

A Unity Editor Tool that create a C# script with in input a list of Animator Controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Animator-Parameter-Extractor

Unity 2020.3+

A Unity Editor Tool that create a C# script with in input a list of Animator Controller MainImage


Objective

Create a unique class that contain all the animators parameters.


How to Use

Use the tool is quite simple, as long as you have the Editor Script 'AnimatorParametersEditor.cs'.

Open

Let's start with shortcut, above on the Navigation Board e follow the path 'Tool/Animator Parameter Creation'

Shortcut


Editor Window

When the Editor Window is open it automatically search all Animator Controllers inside the Assets Folder and SubFolders. After the search create a list of Animation Controller so you can immediately start the Reflection.

Editor

⚠️ Warning! If you modify the list there are 3 condition you have tu fulfill before you click!

  1. You cannot have Null Reference in the list.
  2. You cannot have Duplicate instance in the list.
  3. The list cannot be Empty.

Save File and Start Reflection

You now click the Button 'Create File' and it will open Output type Dialog, you can choose whether your output type is enum or string, then open a Save Dialog Panel, when you save the file in the directory you choose it begin the reflection.
It will appear a Progress Bar that indicate the state of the file, at the end of procedure it show a Message Box Content the relative path of the file.

File

This is the Generate File at the end of the Reflection.

public static class AnimatorParameter 
{ 
	public enum Enemy  
	{ 
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Death,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Attack,
		/// <summary>
		/// Parameter Type: Bool
		/// </summary>
		Scream,
	}
	public enum Evil_Wizard  
	{ 
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Death,
		/// <summary>
		/// Parameter Type: Int
		/// </summary>
		Life,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Attack,
		/// <summary>
		/// Parameter Type: Int
		/// </summary>
		Speed,
		/// <summary>
		/// Parameter Type: Bool
		/// </summary>
		IsCasting,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Evil_Laugh,
	}
	public enum Hero  
	{ 
		/// <summary>
		/// Parameter Type: Float
		/// </summary>
		Life,
		/// <summary>
		/// Parameter Type: Float
		/// </summary>
		Speed,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Attack,
		/// <summary>
		/// Parameter Type: Bool
		/// </summary>
		IsJumping,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Wave,
	}
	public enum NPC  
	{ 
		/// <summary>
		/// Parameter Type: Bool
		/// </summary>
		IsTalking,
		/// <summary>
		/// Parameter Type: Trigger
		/// </summary>
		Surprised,
	}
}
public static class AnimatorParameter
{
    public static class Enemy
    {
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Death = "Death";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Attack = "Attack";
        /// <summary>
        /// Parameter Type: Bool
        /// </summary>
        public const string Scream = "Scream";
    }

    public static class Evil_Wizard
    {
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Death = "Death";
        /// <summary>
        /// Parameter Type: Int
        /// </summary>
        public const string Life = "Life";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Attack = "Attack";
        /// <summary>
        /// Parameter Type: Int
        /// </summary>
        public const string Speed = "Speed";
        /// <summary>
        /// Parameter Type: Bool
        /// </summary>
        public const string IsCasting = "IsCasting";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Evil_Laugh = "Evil_Laugh";
    }

    public static class Hero
    {
        /// <summary>
        /// Parameter Type: Float
        /// </summary>
        public const string Life = "Life";
        /// <summary>
        /// Parameter Type: Float
        /// </summary>
        public const string Speed = "Speed";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Attack = "Attack";
        /// <summary>
        /// Parameter Type: Bool
        /// </summary>
        public const string IsJumping = "IsJumping";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Wave = "Wave";
    }

    public static class NPC
    {
        /// <summary>
        /// Parameter Type: Bool
        /// </summary>
        public const string IsTalking = "IsTalking";
        /// <summary>
        /// Parameter Type: Trigger
        /// </summary>
        public const string Surprised = "Surprised";
    }
}

Usage Example

  • Enum type Example

  • String type Example

About

A Unity Editor Tool that create a C# script with in input a list of Animator Controller

License:MIT License


Languages

Language:C# 100.0%