///----------------------------------------------------------------------------------------------

        //...
        public void EnableClip(PlayAnimatorClip playAnimClip)
        {
            activeClips++;
            var index  = ports[playAnimClip];
            var weight = playAnimClip.GetClipWeight();

            clipsMixer.SetInputWeight(index, activeClips == 1 ? 1f : weight);
            activeClipsWeight = activeClips >= 2 ? 1 : weight;
        }
        public void EnableClip(PlayAnimatorClip playAnimClip)
        {
            if (animator == null)
            {
                return;
            }

            if (!graph.IsValid())
            {
                return;
            }

            activeClips++;
            var index  = ports[playAnimClip];
            var weight = playAnimClip.GetClipWeight();

            mixerPlayableHandle.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
            mixerPlayableHandle.SetInputWeight(index, weight);
        }
Example #3
0
        public void EnableClip(PlayAnimatorClip playAnimClip)
        {
            if (animator == null)
            {
                return;
            }

#if UNITY_2017_1_OR_NEWER
            if (!graph.IsValid())
            {
                return;
            }
#elif UNITY_5_6_OR_NEWER
            if (!graph.IsValid())
            {
                return;
            }
#else
            if (!mixerPlayable.IsValid())
            {
                return;
            }
#endif

            activeClips++;
            var index  = ports[playAnimClip];
            var weight = playAnimClip.GetClipWeight();

#if UNITY_2017_1_OR_NEWER
            mixerPlayable.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
            mixerPlayable.SetInputWeight(index, weight);
#elif UNITY_5_6_OR_NEWER
            mixerPlayableHandle.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
            mixerPlayableHandle.SetInputWeight(index, weight);
#else
            mixerPlayable.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
            mixerPlayable.SetInputWeight(index, weight);
#endif
        }