private void SetupOverride(ControllerType controllerType, bool saveController)
        {
            Manager.controlDelay = 4;

            string controllerName;

            if (controllerType == ControllerType.Standing)
            {
                _usingType   = ControllerType.Standing;
                _notUsedType = ControllerType.Seated;

                _originalUsingOverrideController = _avatarDescriptor.CustomStandingAnims;
                _myRuntimeOverrideController     = new AnimatorOverrideController(GetStandingRuntimeOverrideControllerPreset());
                controllerName = GetStandingRuntimeOverrideControllerPreset().name;
            }
            else
            {
                _usingType   = ControllerType.Seated;
                _notUsedType = ControllerType.Standing;

                _originalUsingOverrideController = _avatarDescriptor.CustomSittingAnims;
                _myRuntimeOverrideController     = new AnimatorOverrideController(GetSeatedRuntimeOverrideControllerPreset());
                controllerName = GetSeatedRuntimeOverrideControllerPreset().name;
            }

            GenerateDictionary();

            var finalOverride = new List <KeyValuePair <AnimationClip, AnimationClip> >
            {
                new KeyValuePair <AnimationClip, AnimationClip>(_myRuntimeOverrideController["[EXTRA] CustomAnimation"], Manager.customAnim)
            };


            var validOverrides = new List <KeyValuePair <AnimationClip, AnimationClip> >();

            foreach (var pair in GmgAnimatorControllerHelper.GetOverrides(_originalUsingOverrideController).Where(keyValuePair => keyValuePair.Value))
            {
                try
                {
                    validOverrides.Add(new KeyValuePair <AnimationClip, AnimationClip>(_myRuntimeOverrideController[_myTranslateDictionary[pair.Key.name]], pair.Value));
                }
                catch (Exception)
                {
                    // ignored
                }
            }

            finalOverride.AddRange(validOverrides);

            _hasBeenOverridden = new Dictionary <string, bool>();
            foreach (var valuePair in finalOverride)
            {
                _hasBeenOverridden[valuePair.Key.name] = true;
            }

            _myRuntimeOverrideController.ApplyOverrides(finalOverride);

            if (saveController)
            {
                Manager.avatarWasUsing = AvatarAnimator.runtimeAnimatorController;
            }

            AvatarAnimator.runtimeAnimatorController      = _myRuntimeOverrideController;
            AvatarAnimator.runtimeAnimatorController.name = controllerName;
        }
        private void OnEditModeChange(bool editMode)
        {
            if (editMode)
            {
                ForgetAvatar();
                _editAvatar      = UnityEngine.Object.Instantiate(Avatar);
                _editAvatar.name = Avatar.name + " (Edit-Mode)";

                Avatar.SetActive(false);
                Avatar.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector;
                _editAvatar.GetOrAddComponent <Animator>().runtimeAnimatorController = GmgAnimatorControllerHelper.CreateControllerWith(OriginalClips);
                _radialMenu.MainMenuPrefab();
                EditorApplication.DirtyHierarchyWindowSorting();
            }
            else
            {
                if (_editAvatar)
                {
                    UnityEngine.Object.DestroyImmediate(_editAvatar);
                }

                Avatar.SetActive(true);
                Avatar.hideFlags = HideFlags.None;

                AvatarAnimator.Update(1f);
                AvatarAnimator.runtimeAnimatorController = null;
                AvatarAnimator.Update(1f);
                InitForAvatar();
                EditorApplication.DirtyHierarchyWindowSorting();
            }
        }