public static void FixAnimationsHideFlags(List <AnimatorOverrideController> overrideControllers, HideFlags hideFlags)
        {
            int fixCount = 0;

            foreach (var overrideController in overrideControllers)
            {
#if !(UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0 || UNITY_4)
                List <AnimationClip> clips = AnimatorOverrideControllerInspector.GetIncludeAnimations(overrideController);
                foreach (AnimationClip clip in clips)
                {
                    if (clip.hideFlags == hideFlags)
                    {
                        continue;
                    }
                    clip.hideFlags = hideFlags;
                    EditorUtility.SetDirty(clip);
                    fixCount++;
                }
#endif
            }

            if (fixCount > 0)
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                UIControllerDebugger.LogMessage(3, fixCount + " override animations Hide Flags is set to " + hideFlags + ".");
            }
        }
        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.");
            }
        }
Exemple #3
0
        private static void FixAnimationsHide(List <AnimatorOverrideController> overrideControllers)
        {
            int fixCount = 0;

            foreach (var overrideController in overrideControllers)
            {
#if !(UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0 || UNITY_4)
                List <AnimationClip> clips = AnimatorOverrideControllerInspector.GetIncludeAnimations(overrideController);
                foreach (AnimationClip clip in clips)
                {
                    if (clip.hideFlags == HideFlags.None)
                    {
                        continue;
                    }
                    clip.hideFlags = HideFlags.None;
                    EditorUtility.SetDirty(clip);
                    fixCount++;
                }
#endif
            }

            if (fixCount > 0)
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                UIControllerDebugger.LogWarning(3, fixCount + " Override Controllers is Fix.");
            }
        }
        public static void FixAllOverrideControllers(UIControllerSetting setting)
        {
            List <AnimatorOverrideController> overrideControllers = FindAllOverrideControllers(setting);

            UIControllerDebugger.FixAnimationsNotSet(overrideControllers);
            UIControllerDebugger.FixAnimationsHideFlags(overrideControllers, setting.overrideAnimationsHideFlags);
            UIControllerDebugger.FixControllerMainObject(overrideControllers);
        }
Exemple #5
0
 void OnValidate()
 {
     if (this.transition.exitTime != this.m_Transition.exitTime || this.transition.duration != this.m_Transition.duration)
     {
         this.m_Transition = this.transition;
         foreach (RuntimeAnimatorController controller in this.controllers)
         {
             this.UpdateControllerTransition(controller);
         }
     }
     if (this.hideOverrideAnimations != this.m_HideOverrideAnimations)
     {
         this.m_HideOverrideAnimations = this.hideOverrideAnimations;
         UIControllerDebugger.FixAnimationsHideFlags(UIControllerDebugger.FindAllOverrideControllers(this), this.overrideAnimationsHideFlags);
     }
 }
        public static void FixAllControllers(UIControllerSetting setting)
        {
            int fixCount = 0;

            foreach (var controller in setting.controllers)
            {
                AnimatorController animator = controller as AnimatorController;
                if (animator.GetBehaviours <UIControllerStateMachine>().Length == 0)
                {
                    var baseLayer = animator.layers[0];
                    baseLayer.stateMachine.AddStateMachineBehaviour <UIControllerStateMachine>();
                    fixCount++;
                }
            }
            if (fixCount > 0)
            {
                UIControllerDebugger.LogMessage(1, fixCount + " controllers UIControllerStateMachine missing is fix.");
            }
        }
        private static void FixControllerMainObject(List <AnimatorOverrideController> overrideControllers)
        {
#if !(UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0 || UNITY_4)
            int fixCount = 0;

            foreach (var overrideController in overrideControllers)
            {
                if (!AssetDatabase.IsMainAsset(overrideController))
                {
                    AssetDatabase.SetMainObject(overrideController, AssetDatabase.GetAssetPath(overrideController));
                    EditorUtility.SetDirty(overrideController);
                    fixCount++;
                }
            }

            if (fixCount > 0)
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                UIControllerDebugger.LogMessage(4, fixCount + " override controllers Main Object is set.");
            }
#endif
        }