Skip to content

SpriteAnimator.Play(string, bool) Method

Plays an animation by name from the beginning.

public void Play(string animationName, bool restart=false);

Parameters

animationName System.String

Name of the animation to play.

restart System.Boolean

When false (default): if the same clip is already the active animation and it is still playing or paused, the call is a no-op. A finished clip is always restarted even when restart is false. Use true to force a restart unconditionally (including while playing or paused).

Exceptions

System.InvalidOperationException
Thrown if the clip has no frames.