Mecanim: Using new automatic settings?

When creating a new transition with Mecanim/Animator the automatic transition settings are set as such:

I would like to make some of those settings be false or 0, I found the way to do that but I have to click on a button to clean up all the transitions in an Animator.
Now I hope to take it a step further and change those settings as soon as I create the transition (it would be like having my personal defaults settings). Is there some kind of event that I can listen to that gets called on the creation of transitions in Mecanim?

1 Like

For the moment, you can’t setup your own defaults, or really mass-edit transitions (the multi-object inspector is already used to display a list of transitions when selecting multiple transitions between two states in the Animator Window).

We have a team working on implementing defaults, but it’s not ready yet.
We also added copy paste of transition settings in 2017.2, which might help in the meantime.
Otherwise, it’s always possible to implement your own editor scripts to force settings on transitions

1 Like

What do you mean by this?

That’s really nice that you plan on giving us defaults, it’d be really useful indeed.

In the meantime, if someone’s interested in setting all the transitions to something specific in an animator, you can use this code: (just have to drag and drop the animator in an EditorWindow then execute this code)

private void CleanTransitions()
    {
        //var allAnimatorControllers = GameObject.FindObjectsOfType<AnimatorController>();
        //foreach (var animController in allAnimatorControllers)
        //{
        //    // Do for all in the project
        //}
        if (AnimatorController) // private static AnimatorController AnimatorController;
        {
            for (int i = 0; i < AnimatorController.layers.Length; i++)
            {
                var stateMachine = AnimatorController.layers[i].stateMachine;

                if (stateMachine == null) return;

                var states = stateMachine.states;

                List<AnimatorStateTransition> allTransitions = new List<AnimatorStateTransition>();
                foreach (var state in states)
                {
                    allTransitions.AddRange(state.state.transitions);
                }

                foreach (var transition in allTransitions)
                {
                    transition.duration = 0;
                    transition.exitTime = 1;

                    //transition.canTransitionToSelf = false;
                    //transition.hasExitTime = false;
                    //transition.hasFixedDuration = true;
                    //transition.interruptionSource = TransitionInterruptionSource.None;
                    //transition.offset = 0;
                }
            }
        }
    }

I added a right click, contextual menu in the transition inspector to copy and paste transition settings and/or conditions.

You right click a transition in the list of transitions, select copy.
Then you right click another transition, and select “Paste Settings”, “Paste Conditions” or “Paste Both”.

2 Likes

Any news on the default settings for the Animator?