Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AnimatorControllerのTransitionDurationを0にする
using UnityEditor;
using UnityEditor.Animations;
public class UpdateTransitions
{
[MenuItem("Assets/UpdateTransitionTime")]
static void Do()
{
foreach( var obj in Selection.objects)
{
var ac = obj as AnimatorController;
if (ac == null)
return;
foreach (var layer in ac.layers)
{
var stateMachine = layer.stateMachine;
RecursiveStateMachineUpdate(stateMachine);
}
}
}
static void RecursiveStateMachineUpdate(AnimatorStateMachine stateMachine)
{
foreach (var state in stateMachine.states)
{
foreach (var transition in state.state.transitions)
{
transition.duration = 0;
}
}
foreach (var transition in stateMachine.anyStateTransitions)
{
transition.duration = 0;
}
foreach ( var sm in stateMachine.stateMachines)
{
RecursiveStateMachineUpdate(sm.stateMachine);
}
}
}
@GameEgg

This comment has been minimized.

Copy link

GameEgg commented Jan 18, 2019

update transitions from 'Any State'

foreach (var transition in stateMachine.anyStateTransitions)
{
    transition.duration = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.