AnimancerComponent.

TryPlay(IHasKey, float, FadeMode) Method

Summary

Starts fading in the animation registered with the `key` while fading out all others in the same layer over the course of the `fadeDuration` and returns the animation's state.
Assembly
Animancer.dll
Namespace
Animancer
Containing Type
AnimancerComponent

Syntax

public AnimancerState TryPlay(IHasKey hasKey, float fadeDuration, FadeMode mode = default(FadeMode))

Remarks

If no state is registered with the `key`, this method does nothing and returns null.

If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this method allows it to continue the existing fade rather than starting a slower one.

If the layer currently has 0 Animancer.AnimancerNode.Weight, this method will fade in the layer itself and simply Animancer.AnimancerState.Play the `state`.

This method is safe to call repeatedly without checking whether the animation was already playing.

Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in runtime builds.

Parameters

Name Type Description
hasKey IHasKey
fadeDuration float
mode FadeMode

Return Value

Type Description
AnimancerState