AnimancerGraph.

DefaultFadeDuration Property

Summary

The fade duration to use if not specified. Default is 0.25.
Assembly
Animancer.dll
Namespace
Animancer
Containing Type
AnimancerGraph

Syntax

public static float DefaultFadeDuration { get; set; }

Remarks

Animancer Lite doesn't allow this value to be changed in runtime builds (except to 0).

Example: UnityEngine.Sprite based games often have no use for fading so you could set this value to 0 using the following script so that you don't need to manually set the Animancer.ITransition.FadeDuration of all your transitions.

To set this value automatically on startup, put the following class into any script:

namespace Animancer
{
    internal static class DefaultFadeDuration
    {
        [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)]
        private static void Initialize() => AnimancerGraph.DefaultFadeDuration = 0;
    }
}
Using that specific namespace (Animancer.AnimancerGraph.DefaultFadeDurationNamespace) and class name (Animancer.AnimancerGraph.DefaultFadeDurationClass) allows Animancer to find and run it immediately in the Unity Editor so that newly created transition fields can start with the correct value (using a [UnityEditor.InitializeOnLoadMethod] attribute would run it too late).

Value

Type Description
float