コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Animator の Transition を 2D アニメーションが即座に切り替わるように変更するエディタ拡張

概要

using UnityEditor;
using UnityEditor.Animations;

public static class AnimatorStateTransitionContext
{
    [MenuItem( "CONTEXT/AnimatorStateTransition/Reset Simple" )]
    private static void ResetSimple( MenuCommand command )
    {
        var transition = command.context as AnimatorStateTransition;

        Undo.RecordObject( transition, "Reset Simple" );

        transition.hasExitTime         = false;
        transition.exitTime            = 0;
        transition.hasFixedDuration    = false;
        transition.duration            = 0;
        transition.offset              = 0;
        transition.canTransitionToSelf = false;
    }
}

f:id:baba_s:20191025102329g:plain