private static void FixAnimationsNotSet(List <AnimatorOverrideController> overrideControllers) { int fixCount = 0; foreach (var overrideController in overrideControllers) { bool isFix = false; var overrides = overrideController.GetOverridesUnite(); foreach (var clipPair in overrides) { if (clipPair.Key == clipPair.Value) { AnimatorOverrideControllerInspector.SetupController(overrideController); isFix = true; break; } } fixCount += isFix ? 1 : 0; } if (fixCount > 0) { UIControllerDebugger.LogMessage(2, fixCount + " override controllers no override animation is fix."); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); var overrideController = this.target as AnimatorOverrideController; List <AnimationClip> clips = AnimatorOverrideControllerInspector.GetIncludeAnimations(overrideController); if (clips.Count > 0) { string names = clips[0].name; for (int i = 1; i < clips.Count; i++) { names += ", " + clips[i].name; } GUILayout.Label("Include Animations: " + names); } foreach (var controller in UIControllerSetting.instance.controllers) { if (GUILayout.Button("Setup " + controller.name.Replace("_", "->"))) { AnimatorOverrideControllerInspector.SetupController(overrideController, controller); } } GUILayout.Label(""); List <AnimationClip> unusedClips = AnimatorOverrideControllerInspector.GetUnusedAnimations(overrideController); GUI.enabled = unusedClips.Count > 0; if (GUILayout.Button("Delete Unused Animations (" + unusedClips.Count + ")")) { foreach (AnimationClip clip in unusedClips) { Object.DestroyImmediate(clip, true); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } GUI.enabled = true; GUI.enabled = overrideController.runtimeAnimatorController != null; if (GUILayout.Button("Export to Animator")) { AnimatorOverrideControllerInspector.ExportController(overrideController); } GUI.enabled = true; }
public static void FixAllOverrideControllers(UIControllerSetting setting) { int fixCount = 0; List <AnimatorOverrideController> all = FindAllOverrideControllers(setting); foreach (var a in all) { foreach (AnimationClipPair clipPair in a.clips) { if (clipPair.originalClip == clipPair.overrideClip) { AnimatorOverrideControllerInspector.SetupController(a); fixCount++; break; } } } if (fixCount > 0) { Debug.LogWarning("UIController: " + fixCount + " Override Controllers is Fix. (Error 2)"); } }