├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── TimeManager.asset ├── AudioManager.asset ├── EditorSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── DynamicsManager.asset ├── GraphicsSettings.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── UnityAdsSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset ├── Physics2DSettings.asset └── UnityConnectSettings.asset ├── screenshot.png ├── package.unitypackage ├── Assets ├── Animator Controller Parameter Picker │ ├── Example │ │ ├── Animator │ │ │ ├── Cube.controller │ │ │ ├── CubeIdle.anim │ │ │ ├── CubeJump.anim │ │ │ ├── CubeScaled.anim │ │ │ ├── CubeRotated.anim │ │ │ ├── Cube.controller.meta │ │ │ ├── CubeIdle.anim.meta │ │ │ ├── CubeJump.anim.meta │ │ │ ├── CubeRotated.anim.meta │ │ │ └── CubeScaled.anim.meta │ │ ├── Scenes │ │ │ ├── ExampleScene.unity │ │ │ └── ExampleScene.unity.meta │ │ ├── Animator.meta │ │ ├── Scenes.meta │ │ ├── ToggleParamOnClick.cs.meta │ │ ├── SetTriggerParamOnClick.cs.meta │ │ ├── SetTriggerParamOnClick.cs │ │ └── ToggleParamOnClick.cs │ ├── Example.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Editor.meta │ │ ├── AnimatorControllerTriggerParameter.cs │ │ ├── AnimatorControllerBoolParameter.cs.meta │ │ ├── AnimatorControllerFloatParameter.cs.meta │ │ ├── AnimatorControllerTriggerParameter.cs.meta │ │ ├── Editor │ │ ├── AnimatorControllerParameterRefPropertyDrawer.cs.meta │ │ └── AnimatorControllerParameterRefPropertyDrawer.cs │ │ ├── AnimatorControllerBoolParameter.cs │ │ └── AnimatorControllerFloatParameter.cs └── Animator Controller Parameter Picker.meta ├── .gitignore └── README.md /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.5p4 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/screenshot.png -------------------------------------------------------------------------------- /package.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/package.unitypackage -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/Cube.controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Animator/Cube.controller -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeIdle.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Animator/CubeIdle.anim -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeJump.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Animator/CubeJump.anim -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeScaled.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Animator/CubeScaled.anim -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeRotated.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Animator/CubeRotated.anim -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Scenes/ExampleScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miguel12345/AnimatorControllerParameterPicker/HEAD/Assets/Animator Controller Parameter Picker/Example/Scenes/ExampleScene.unity -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9778c198950054cdf9e0931ee6369511 3 | folderAsset: yes 4 | timeCreated: 1471505076 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Scenes/ExampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f3745e939d044a42962971a33fd4ee1 3 | timeCreated: 1471504977 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38cebc9ddd01b48e2b4032a04e9d0c04 3 | folderAsset: yes 4 | timeCreated: 1471505090 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/Cube.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd55714be6e4d4c3f8638efbf739fb40 3 | timeCreated: 1471504608 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeIdle.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2cb84f59f22b490abd62b8feca5747a 3 | timeCreated: 1471504608 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeJump.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 355f127b8c65643459e25dac6402695b 3 | timeCreated: 1471504675 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeRotated.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 807fc4c3525774d229e0c30f51262ec2 3 | timeCreated: 1471504887 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator/CubeScaled.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 974a0fbc69d3b41feb7198b3016e7546 3 | timeCreated: 1471504762 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33860f0611fd74ddb86fdfafd2853d44 3 | folderAsset: yes 4 | timeCreated: 1471504985 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Animator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b9d3b03d475a4a428ac1b02a650908d 3 | folderAsset: yes 4 | timeCreated: 1471504525 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e766c2227e1144a69e92c27238e7ba5 3 | folderAsset: yes 4 | timeCreated: 1471504977 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d74daff7188da4886af73643b5b75af2 3 | folderAsset: yes 4 | timeCreated: 1471505061 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerTriggerParameter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System; 4 | 5 | [Serializable] 6 | public class AnimatorControllerTriggerParameter { 7 | 8 | public int NameID; 9 | 10 | public void Set(Animator animator) { 11 | animator.SetTrigger (NameID); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/ToggleParamOnClick.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51be54e72eb7a45fb82d5865d3923c8a 3 | timeCreated: 1471504999 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/SetTriggerParamOnClick.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3727d0a22779c465f923ab9384b41179 3 | timeCreated: 1471505010 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerBoolParameter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4de72d450efb1452392f8b9790aebc46 3 | timeCreated: 1471505061 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerFloatParameter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1ee071f4f480442eb7202739631bd0b 3 | timeCreated: 1471505061 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerTriggerParameter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7e772cd0a2d9433bbbdcb39c628a8d5 3 | timeCreated: 1471505061 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/Editor/AnimatorControllerParameterRefPropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9eb22cfb74ce74ef9bb5b0019d3abc0f 3 | timeCreated: 1471420441 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerBoolParameter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System; 4 | 5 | [Serializable] 6 | public class AnimatorControllerBoolParameter{ 7 | 8 | public int NameID; 9 | 10 | public bool Get(Animator animator) { 11 | return animator.GetBool (NameID); 12 | } 13 | 14 | public void Set(Animator animator,bool val) { 15 | animator.SetBool (NameID,val); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /[Ll]ibrary/ 3 | /[Tt]emp/ 4 | /[Oo]bj/ 5 | /[Bb]uild/ 6 | /[Bb]uilds/ 7 | /Assets/AssetStoreTools* 8 | 9 | # Autogenerated VS/MD/Consulo solution and project files 10 | ExportedObj/ 11 | .consulo/ 12 | *.csproj 13 | *.unityproj 14 | *.sln 15 | *.suo 16 | *.tmp 17 | *.user 18 | *.userprefs 19 | *.pidb 20 | *.booproj 21 | *.svd 22 | 23 | 24 | # Unity3D generated meta files 25 | *.pidb.meta 26 | 27 | # Unity3D Generated File On Crash Reports 28 | sysinfo.txt 29 | 30 | # Builds 31 | *.apk -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/SetTriggerParamOnClick.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.EventSystems; 4 | 5 | public class SetTriggerParamOnClick : MonoBehaviour, IPointerClickHandler { 6 | 7 | public AnimatorControllerTriggerParameter Param; 8 | 9 | Animator animator; 10 | 11 | void Awake() { 12 | animator = GetComponent (); 13 | } 14 | 15 | public void OnPointerClick (PointerEventData eventData) { 16 | Param.Set (animator); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Example/ToggleParamOnClick.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.EventSystems; 4 | 5 | public class ToggleParamOnClick : MonoBehaviour, IPointerClickHandler { 6 | 7 | public AnimatorControllerBoolParameter Param; 8 | 9 | Animator animator; 10 | 11 | void Awake() { 12 | animator = GetComponent (); 13 | } 14 | 15 | public void OnPointerClick (PointerEventData eventData) { 16 | Param.Set (animator, !Param.Get (animator)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Animator Controller Parameter Picker 2 | 3 | Tired of having to write glue code to convert your animator's parameter names to hashes to speed up your game and prevent unnecessary allocs? 4 | 5 | With this picker you can just add a public property to your scripts and then you'll get a dropdown list of all the matching parameters for the attached animator. 6 | 7 | On top of that, there are three types of animator parameter classes (Bool, Float and Trigger) to prevent you from making common errors such as trying to call a `SetBool` on a `Trigger` param. 8 | 9 | ![](screenshot.png) -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/AnimatorControllerFloatParameter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System; 4 | 5 | [Serializable] 6 | public class AnimatorControllerFloatParameter { 7 | 8 | public int NameID; 9 | 10 | public float Get(Animator animator) { 11 | return animator.GetFloat (NameID); 12 | } 13 | 14 | public void Set(Animator animator,float val) { 15 | animator.SetFloat (NameID,val); 16 | } 17 | 18 | public void Set(Animator animator,float val,float dampTime, float deltaTime) { 19 | animator.SetFloat (NameID, val, dampTime, deltaTime); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Assets/Animator Controller Parameter Picker/Scripts/Editor/AnimatorControllerParameterRefPropertyDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEditor; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | [CustomPropertyDrawer(typeof(AnimatorControllerBoolParameter))] 8 | [CustomPropertyDrawer(typeof(AnimatorControllerFloatParameter))] 9 | [CustomPropertyDrawer(typeof(AnimatorControllerTriggerParameter))] 10 | public class AnimatorControllerParameterRefPropertyDrawer : PropertyDrawer { 11 | 12 | // Draw the property inside the given rect 13 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { 14 | // Using BeginProperty / EndProperty on the parent property means that 15 | // prefab override logic works on the entire property. 16 | EditorGUI.BeginProperty(position, label, property); 17 | 18 | MonoBehaviour targetMonoBehaviour = (MonoBehaviour) property.serializedObject.targetObject; 19 | var animator = targetMonoBehaviour.GetComponent (); 20 | 21 | 22 | // Draw label 23 | position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); 24 | 25 | 26 | if (animator == null) { 27 | EditorGUILayout.HelpBox("No Animator component found!", MessageType.Warning); 28 | EditorGUI.EndProperty(); 29 | return; 30 | } 31 | 32 | var propertyType = property.type; 33 | bool isBoolParameter = propertyType == typeof(AnimatorControllerBoolParameter).Name; 34 | bool isFloatParameter = propertyType == typeof(AnimatorControllerFloatParameter).Name; 35 | bool isTriggerParameter = propertyType == typeof(AnimatorControllerTriggerParameter).Name; 36 | 37 | var NameIDProperty = property.FindPropertyRelative ("NameID"); 38 | List animatorParameters = new List (); 39 | 40 | 41 | int parameterCount = animator.parameterCount; 42 | for (int i = 0; i < parameterCount; i++) { 43 | var parameter = animator.GetParameter (i); 44 | if (parameter.type == AnimatorControllerParameterType.Bool && isBoolParameter) { 45 | animatorParameters.Add (parameter); 46 | } 47 | else if (parameter.type == AnimatorControllerParameterType.Float && isFloatParameter) { 48 | animatorParameters.Add (parameter); 49 | } 50 | else if (parameter.type == AnimatorControllerParameterType.Trigger && isTriggerParameter) { 51 | animatorParameters.Add (parameter); 52 | } 53 | } 54 | 55 | List animatorParameterNames = new List (); 56 | int currentlySelectedParameterIndex = 0; 57 | 58 | for (int i = 0; i < animatorParameters.Count; i++) { 59 | animatorParameterNames.Add (animatorParameters [i].name); 60 | if (NameIDProperty.intValue == animatorParameters [i].nameHash) { 61 | currentlySelectedParameterIndex = i; 62 | } 63 | } 64 | 65 | if (animatorParameterNames.Count == 0) { 66 | var warningText = string.Format ("No {0} parameters found in the animator", isBoolParameter ? "Bool" : (isFloatParameter ? "Float" : "Trigger")); 67 | EditorGUILayout.HelpBox(warningText, MessageType.Warning); 68 | } else { 69 | int selectedIndex = EditorGUI.Popup(position,currentlySelectedParameterIndex, animatorParameterNames.ToArray()); 70 | NameIDProperty.intValue = animatorParameters[selectedIndex].nameHash; 71 | } 72 | 73 | EditorGUI.EndProperty(); 74 | } 75 | 76 | } 77 | --------------------------------------------------------------------------------