public override void OnInspectorGUI() { if (GUILayout.Button("Open Event Editor")) { MecanimEventEditor editor = EditorWindow.GetWindow <MecanimEventEditor>(); editor.TargetController = serializedObject.FindProperty("lastEdit").objectReferenceValue; } if (previewedMotion != null && previewedMotion is UnityEditor.Animations.BlendTree && avatarPreview != null) { EditorGUILayout.Separator(); GUILayout.Label("BlendTree Parameter(s)", GUILayout.ExpandWidth(true)); UnityEditor.Animations.BlendTree bt = previewedMotion as UnityEditor.Animations.BlendTree; for (int i = 0; i < bt.GetRecursiveBlendParamCount(); i++) { float min = bt.GetRecursiveBlendParamMin(i); float max = bt.GetRecursiveBlendParamMax(i); string paramName = bt.GetRecursiveBlendParam(i); float value = Mathf.Clamp(avatarPreview.Animator.GetFloat(paramName), min, max); value = EditorGUILayout.Slider(paramName, value, min, max); avatarPreview.Animator.SetFloat(paramName, value); } } }
private void CreateParameters() { int parameterCount = 0;// controller.parameterCount; for (int i = 0; i < parameterCount; i++) { controller.RemoveParameter(0); } if (previewedMotion is UnityEditor.Animations.BlendTree) { UnityEditor.Animations.BlendTree blendTree = previewedMotion as UnityEditor.Animations.BlendTree; for (int j = 0; j < blendTree.GetRecursiveBlendParamCount(); j++) { //controller.AddParameter(blendTree.GetRecursiveBlendParam(j), AnimatorControllerParameterType.Float); } } }