reckfellENGINE

AnimationPlayer

Plays named clips and controls their time.

On this page
class AnimationPlayerReckfellSharpInherits AnimationMixer

Use Play() to start, Pause() to resume later and Stop() to stop and reset. Calling Play() again for the same clip is not an explicit restart. Full keys include the library name except for the empty global library.

Play() schedules property application; Advance(0) applies the pose immediately. For preview without method events, use Seek(..., update: true, updateOnly: true). When AnimationTree controls the same targets, change tree state instead of playing concurrently.

Complete example and diagnostics

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

AnimationPlayerConstructor
# AnimationPlayer
C#
public AnimationPlayer();

Properties16

AssignedAnimationProperty
# AssignedAnimation
C#
public StringName AssignedAnimation { get; set; }

The assigned name remains after stopping; reading it does not prove active playback. Setting it while stopped configures the clip at time 0 without starting; setting it during playback switches clips.

AutoplayProperty
# Autoplay
C#
public StringName Autoplay { get; set; }

The key of the animation to play when the scene loads.

ClearCacheOnStopProperty
# ClearCacheOnStop
C#
public bool ClearCacheOnStop { get; set; }

If true, the animation track cache is cleared when the animation is stopped or the playback queue becomes empty. If false, the track cache is preserved, which can improve performance when animations are frequently started and stopped.

CurrentAnimationProperty
# CurrentAnimation
C#
public StringName CurrentAnimation { get; set; }

The key of the currently playing animation. If no animation is playing, the property's value is an empty string. Changing this value does not restart the animation. See AnimationPlayer.Play for more information on playing animations. Note: While this property appears in the Inspector, it's not meant to be edited, and it's not saved in the scene. This property is mainly used to get the currently playing animation, and internally for animation playback tracks. For more information, see Animation.

CurrentAnimationLengthProperty
# CurrentAnimationLength
C#
public double CurrentAnimationLength { get; }

The length (in seconds) of the currently playing animation.

CurrentAnimationPositionProperty
# CurrentAnimationPosition
C#
public double CurrentAnimationPosition { get; }

The current clip time in seconds. Reading without a current clip, such as immediately after Stop(), emits an error and returns 0; that is not a successful start-position check. Assign a clip through AssignedAnimation or start Play() first. Pause retains the current position.

MethodCallModeProperty
# MethodCallMode
C#
public AnimationPlayer.AnimationMethodCallMode MethodCallMode { get; set; }
MovieQuitOnFinishProperty
# MovieQuitOnFinish
C#
public bool MovieQuitOnFinish { get; set; }

If true and the engine is running in Movie Maker mode (see MovieWriter), exits the engine with EntityTree.Quit as soon as an animation is done playing in this AnimationPlayer. A message is printed when the engine quits for this reason. Note: This obeys the same logic as the AnimationMixer.AnimationFinished signal, so it will not quit the engine if the animation is set to be looping.

PlaybackActiveProperty
# PlaybackActive
C#
public bool PlaybackActive { get; set; }
PlaybackAutoCaptureProperty
# PlaybackAutoCapture
C#
public bool PlaybackAutoCapture { get; set; }

If true, performs AnimationMixer.Capture before playback automatically. This means just AnimationPlayer.PlayWithCapture is executed with default arguments instead of AnimationPlayer.Play. Note: Capture interpolation is only performed if the animation contains a capture track. See also Animation.UpdateMode.Capture.

PlaybackAutoCaptureDurationProperty
# PlaybackAutoCaptureDuration
C#
public double PlaybackAutoCaptureDuration { get; set; }

See also AnimationPlayer.PlayWithCapture and AnimationMixer.Capture. If AnimationPlayer.PlaybackAutoCaptureDuration is negative value, the duration is set to the interval between the current position and the first key.

PlaybackAutoCaptureEaseTypeProperty
# PlaybackAutoCaptureEaseType
C#
public Tween.EaseType PlaybackAutoCaptureEaseType { get; set; }

The ease type of the capture interpolation. See also Tween.EaseType.

PlaybackAutoCaptureTransitionTypeProperty
# PlaybackAutoCaptureTransitionType
C#
public Tween.TransitionType PlaybackAutoCaptureTransitionType { get; set; }

The transition type of the capture interpolation. See also Tween.TransitionType.

PlaybackDefaultBlendTimeProperty
# PlaybackDefaultBlendTime
C#
public double PlaybackDefaultBlendTime { get; set; }

The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision.

PlaybackProcessModeProperty
# PlaybackProcessMode
C#
public AnimationPlayer.AnimationProcessCallback PlaybackProcessMode { get; set; }
SpeedScaleProperty
# SpeedScale
C#
public float SpeedScale { get; set; }

The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed. If set to a negative value, the animation is played in reverse. If set to 0, the animation will not advance.

Methods60

AnimationGetNextStringName
# AnimationGetNext
C#
public StringName AnimationGetNext(StringName animationFrom);

Returns the key of the animation which is queued to play after the animation_from animation.

Parameters
NameTypeDefault
animationFromStringName—
Returns StringName
AnimationSetNextvoid
# AnimationSetNext
C#
public void AnimationSetNext(StringName animationFrom, StringName animationTo);

Triggers the animation_to animation when the animation_from animation completes.

Parameters
NameTypeDefault
animationFromStringName—
animationToStringName—
ClearQueuevoid
# ClearQueue
C#
public void ClearQueue();

Clears all queued, unplayed animations.

GetAssignedAnimationStringName
# GetAssignedAnimation
C#
public StringName GetAssignedAnimation();
Returns StringName
GetAutoCaptureDurationdouble
# GetAutoCaptureDuration
C#
public double GetAutoCaptureDuration();
Returns double
GetAutoCaptureEaseTypeTween.EaseType
# GetAutoCaptureEaseType
C#
public Tween.EaseType GetAutoCaptureEaseType();
Returns Tween.EaseType
GetAutoCaptureTransitionTypeTween.TransitionType
# GetAutoCaptureTransitionType
C#
public Tween.TransitionType GetAutoCaptureTransitionType();
Returns Tween.TransitionType
GetAutoplayStringName
# GetAutoplay
C#
public StringName GetAutoplay();
Returns StringName
GetBlendTimedouble
# GetBlendTime
C#
public double GetBlendTime(StringName animationFrom, StringName animationTo);

Returns the blend time (in seconds) between two animations, referenced by their keys.

Parameters
NameTypeDefault
animationFromStringName—
animationToStringName—
Returns double
GetCurrentAnimationStringName
# GetCurrentAnimation
C#
public StringName GetCurrentAnimation();
Returns StringName
GetCurrentAnimationLengthdouble
# GetCurrentAnimationLength
C#
public double GetCurrentAnimationLength();
Returns double
GetCurrentAnimationPositiondouble
# GetCurrentAnimationPosition
C#
public double GetCurrentAnimationPosition();

The current clip time in seconds. Reading without a current clip, such as immediately after Stop(), emits an error and returns 0; that is not a successful start-position check. Assign a clip through AssignedAnimation or start Play() first. Pause retains the current position.

Returns double
GetDefaultBlendTimedouble
# GetDefaultBlendTime
C#
public double GetDefaultBlendTime();
Returns double
GetMethodCallModeAnimationPlayer.AnimationMethodCallMode · Deprecated
# GetMethodCallMode
C#
public AnimationPlayer.AnimationMethodCallMode GetMethodCallMode();

Returns the call mode used for "Call Method" tracks.

Returns AnimationPlayer.AnimationMethodCallMode
GetPlayingSpeedfloat
# GetPlayingSpeed
C#
public float GetPlayingSpeed();

Returns the actual playing speed of current animation or 0 if not playing. This speed is the AnimationPlayer.SpeedScale property multiplied by custom_speed argument specified when calling the AnimationPlayer.Play method. Returns a negative value if the current animation is playing backwards.

Returns float
GetProcessCallbackAnimationPlayer.AnimationProcessCallback · Deprecated
# GetProcessCallback
C#
public AnimationPlayer.AnimationProcessCallback GetProcessCallback();

Returns the process notification in which to update animations.

Returns AnimationPlayer.AnimationProcessCallback
GetQueueReckfell.Collections.Array<StringName>
# GetQueue
C#
public Reckfell.Collections.Array<StringName> GetQueue();

Returns a list of the animation keys that are currently queued to play.

Returns Reckfell.Collections.Array<StringName>
GetRootEntityPath · Deprecated
# GetRoot
C#
public EntityPath GetRoot();

Returns the node which node path references will travel from.

Returns EntityPath
GetSectionEndTimedouble
# GetSectionEndTime
C#
public double GetSectionEndTime();

Returns the end time of the section currently being played.

Returns double
GetSectionStartTimedouble
# GetSectionStartTime
C#
public double GetSectionStartTime();

Returns the start time of the section currently being played.

Returns double
GetSpeedScalefloat
# GetSpeedScale
C#
public float GetSpeedScale();
Returns float
HasSectionbool
# HasSection
C#
public bool HasSection();

Returns true if an animation is currently playing with a section.

Returns bool
IsAnimationActivebool
# IsAnimationActive
C#
public bool IsAnimationActive();

Returns true if the an animation is currently active. An animation is active if it was played by calling AnimationPlayer.Play and was not finished yet, or was stopped by calling AnimationPlayer.Stop. This can be used to check whether an animation is currently paused or stopped.

Returns bool
IsAutoCapturebool
# IsAutoCapture
C#
public bool IsAutoCapture();
Returns bool
IsClearCacheOnStopEnabledbool
# IsClearCacheOnStopEnabled
C#
public bool IsClearCacheOnStopEnabled();
Returns bool
IsMovieQuitOnFinishEnabledbool
# IsMovieQuitOnFinishEnabled
C#
public bool IsMovieQuitOnFinishEnabled();
Returns bool
IsPlayingbool
# IsPlaying
C#
public bool IsPlaying();

Reports playback state, not whether the pose is changing or speed is nonzero. It can return true at SpeedScale=0. After Pause() it is false even though the assigned clip and its position remain.

Returns bool
Pausevoid
# Pause
C#
public void Pause();

Pauses automatic playback while retaining time and pose. Play() without a name resumes the assigned clip. An explicit manual Advance() can still step it; code that owns manual timing must account for pause.

Playvoid
# Play
C#
public void Play(StringName name = null, double customBlend = -1d, float customSpeed = 1f, bool fromEnd = false);

Plays a full library key; an empty name continues the assigned clip. Replaying the same name is not a restart command. Use Stop() then Play() for an explicit restart. Properties update during processing; Advance(0) applies the starting pose immediately. SpeedScale also affects playback speed.

Parameters
NameTypeDefault
nameStringNamenull
customBlenddouble-1d
customSpeedfloat1f
fromEndboolfalse
PlayBackwardsvoid
# PlayBackwards
C#
public void PlayBackwards(StringName name = null, double customBlend = -1d);

Plays the animation with key name in reverse. This method is a shorthand for AnimationPlayer.Play with custom_speed = -1.0 and from_end = true, so see its description for more information. Note: Continuous tracks, including value tracks with Animation.UpdateMode.Continuous, are simply interpolated on the reversed timeline, while value tracks with Animation.UpdateMode.Discrete apply a key only in the frame it is passed, so the value held between two keys can differ from forward playback.

Parameters
NameTypeDefault
nameStringNamenull
customBlenddouble-1d
PlaySectionvoid
# PlaySection
C#
public void PlaySection(StringName name = null, double startTime = -1d, double endTime = -1d, double customBlend = -1d, float customSpeed = 1f, bool fromEnd = false);

Plays the animation with key name and the section starting from start_time and ending on end_time. See also AnimationPlayer.Play. Setting start_time to a value outside the range of the animation means the start of the animation will be used instead, and setting end_time to a value outside the range of the animation means the end of the animation will be used instead. start_time cannot be equal to end_time.

Parameters
NameTypeDefault
nameStringNamenull
startTimedouble-1d
endTimedouble-1d
customBlenddouble-1d
customSpeedfloat1f
fromEndboolfalse
PlaySectionBackwardsvoid
# PlaySectionBackwards
C#
public void PlaySectionBackwards(StringName name = null, double startTime = -1d, double endTime = -1d, double customBlend = -1d);

Plays the animation with key name and the section starting from start_time and ending on end_time in reverse. This method is a shorthand for AnimationPlayer.PlaySection with custom_speed = -1.0 and from_end = true, see its description for more information.

Parameters
NameTypeDefault
nameStringNamenull
startTimedouble-1d
endTimedouble-1d
customBlenddouble-1d
PlaySectionWithMarkersvoid
# PlaySectionWithMarkers
C#
public void PlaySectionWithMarkers(StringName name = null, StringName startMarker = null, StringName endMarker = null, double customBlend = -1d, float customSpeed = 1f, bool fromEnd = false);

Plays the animation with key name and the section starting from start_marker and ending on end_marker. If the start marker is empty, the section starts from the beginning of the animation. If the end marker is empty, the section ends on the end of the animation. See also AnimationPlayer.Play.

Parameters
NameTypeDefault
nameStringNamenull
startMarkerStringNamenull
endMarkerStringNamenull
customBlenddouble-1d
customSpeedfloat1f
fromEndboolfalse
PlaySectionWithMarkersBackwardsvoid
# PlaySectionWithMarkersBackwards
C#
public void PlaySectionWithMarkersBackwards(StringName name = null, StringName startMarker = null, StringName endMarker = null, double customBlend = -1d);

Plays the animation with key name and the section starting from start_marker and ending on end_marker in reverse. This method is a shorthand for AnimationPlayer.PlaySectionWithMarkers with custom_speed = -1.0 and from_end = true, see its description for more information.

Parameters
NameTypeDefault
nameStringNamenull
startMarkerStringNamenull
endMarkerStringNamenull
customBlenddouble-1d
PlayWithCapturevoid
# PlayWithCapture
C#
public void PlayWithCapture(StringName name = null, double duration = -1d, double customBlend = -1d, float customSpeed = 1f, bool fromEnd = false, Tween.TransitionType transType = Tween.TransitionType.Linear, Tween.EaseType easeType = Tween.EaseType.In);

See also AnimationMixer.Capture. You can use this method to use more detailed options for capture than those performed by AnimationPlayer.PlaybackAutoCapture. When AnimationPlayer.PlaybackAutoCapture is false, this method is almost the same as the following:

Text
capture(name, duration, trans_type, ease_type)
play(name, custom_blend, custom_speed, from_end)

If name is blank, it specifies AnimationPlayer.AssignedAnimation. If duration is a negative value, the duration is set to the interval between the current position and the first key, when from_end is true, uses the interval between the current position and the last key instead. Note: The duration takes AnimationPlayer.SpeedScale into account, but custom_speed does not, because the capture cache is interpolated with the blend result and the result may contain multiple animations.

Parameters
NameTypeDefault
nameStringNamenull
durationdouble-1d
customBlenddouble-1d
customSpeedfloat1f
fromEndboolfalse
transTypeTween.TransitionTypeTween.TransitionType.Linear
easeTypeTween.EaseTypeTween.EaseType.In
Queuevoid
# Queue
C#
public void Queue(StringName name);

Queues an animation for playback once the current animation and all previously queued animations are done. Note: If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.

Parameters
NameTypeDefault
nameStringName—
ResetSectionvoid
# ResetSection
C#
public void ResetSection();

Resets the current section. Does nothing if a section has not been set.

Seek2 overloads
# Seek · 1/2
C#
public void Seek(double seconds, bool update);

A seek overload without updateOnly. With update=true it can invoke the nearest method key. For preview without those calls, use the three-argument Seek(seconds, update:true, updateOnly:true).

Parameters
NameTypeDefault
secondsdouble—
updatebool—
# Seek · 2/2
C#
public void Seek(double seconds, bool update = false, bool updateOnly = false);

Changes the current clip time. update=true applies the pose immediately; updateOnly=true suppresses method-track calls during that update. An ordinary external seek can invoke the nearest method key and does not play every skipped event. Seeking to the end is not normal clip completion.

Parameters
NameTypeDefault
secondsdouble—
updateboolfalse
updateOnlyboolfalse
SetAssignedAnimation2 overloads
# SetAssignedAnimation · 1/2
C#
public void SetAssignedAnimation(StringName animation);
Parameters
NameTypeDefault
animationStringName—
# SetAssignedAnimation · 2/2
C#
public void SetAssignedAnimation(string animation);
Parameters
NameTypeDefault
animationstring—
SetAutoCapturevoid
# SetAutoCapture
C#
public void SetAutoCapture(bool autoCapture);
Parameters
NameTypeDefault
autoCapturebool—
SetAutoCaptureDurationvoid
# SetAutoCaptureDuration
C#
public void SetAutoCaptureDuration(double autoCaptureDuration);
Parameters
NameTypeDefault
autoCaptureDurationdouble—
SetAutoCaptureEaseTypevoid
# SetAutoCaptureEaseType
C#
public void SetAutoCaptureEaseType(Tween.EaseType autoCaptureEaseType);
Parameters
NameTypeDefault
autoCaptureEaseTypeTween.EaseType—
SetAutoCaptureTransitionTypevoid
# SetAutoCaptureTransitionType
C#
public void SetAutoCaptureTransitionType(Tween.TransitionType autoCaptureTransitionType);
Parameters
NameTypeDefault
autoCaptureTransitionTypeTween.TransitionType—
SetAutoplay2 overloads
# SetAutoplay · 1/2
C#
public void SetAutoplay(StringName name);
Parameters
NameTypeDefault
nameStringName—
# SetAutoplay · 2/2
C#
public void SetAutoplay(string name);
Parameters
NameTypeDefault
namestring—
SetBlendTimevoid
# SetBlendTime
C#
public void SetBlendTime(StringName animationFrom, StringName animationTo, double sec);

Specifies a blend time (in seconds) between two animations, referenced by their keys.

Parameters
NameTypeDefault
animationFromStringName—
animationToStringName—
secdouble—
SetClearCacheOnStopEnabledvoid
# SetClearCacheOnStopEnabled
C#
public void SetClearCacheOnStopEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetCurrentAnimation2 overloads
# SetCurrentAnimation · 1/2
C#
public void SetCurrentAnimation(StringName animation);
Parameters
NameTypeDefault
animationStringName—
# SetCurrentAnimation · 2/2
C#
public void SetCurrentAnimation(string animation);
Parameters
NameTypeDefault
animationstring—
SetDefaultBlendTimevoid
# SetDefaultBlendTime
C#
public void SetDefaultBlendTime(double sec);
Parameters
NameTypeDefault
secdouble—
SetMethodCallModevoid · Deprecated
# SetMethodCallMode
C#
public void SetMethodCallMode(AnimationPlayer.AnimationMethodCallMode mode);

Sets the call mode used for "Call Method" tracks.

Parameters
NameTypeDefault
modeAnimationPlayer.AnimationMethodCallMode—
SetMovieQuitOnFinishEnabledvoid
# SetMovieQuitOnFinishEnabled
C#
public void SetMovieQuitOnFinishEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetProcessCallbackvoid · Deprecated
# SetProcessCallback
C#
public void SetProcessCallback(AnimationPlayer.AnimationProcessCallback mode);

Sets the process notification in which to update animations.

Parameters
NameTypeDefault
modeAnimationPlayer.AnimationProcessCallback—
SetRootvoid · Deprecated
# SetRoot
C#
public void SetRoot(EntityPath path);

Sets the node which node path references will travel from.

Parameters
NameTypeDefault
pathEntityPath—
SetSectionvoid
# SetSection
C#
public void SetSection(double startTime = -1d, double endTime = -1d);

Changes the start and end times of the section being played. The current playback position will be clamped within the new section. See also AnimationPlayer.PlaySection.

Parameters
NameTypeDefault
startTimedouble-1d
endTimedouble-1d
SetSectionWithMarkersvoid
# SetSectionWithMarkers
C#
public void SetSectionWithMarkers(StringName startMarker = null, StringName endMarker = null);

Changes the start and end markers of the section being played. The current playback position will be clamped within the new section. See also AnimationPlayer.PlaySectionWithMarkers. If the argument is empty, the section uses the beginning or end of the animation. If both are empty, it means that the section is not set.

Parameters
NameTypeDefault
startMarkerStringNamenull
endMarkerStringNamenull
SetSpeedScalevoid
# SetSpeedScale
C#
public void SetSpeedScale(float speed);
Parameters
NameTypeDefault
speedfloat—
Stopvoid
# Stop
C#
public void Stop(bool keepState = false);

Stops playback, clears the queue and resets time to the current section start. By default it applies that initial pose; keepState=true preserves applied values. It does not play RESET or emit AnimationFinished. The current position is unavailable until a clip is assigned or started again.

Parameters
NameTypeDefault
keepStateboolfalse

Signals and events2

AnimationChangedEvent
# AnimationChanged
C#
public event AnimationPlayer.AnimationChangedEventHandler AnimationChanged;

Emitted when a queued animation plays after the previous animation finished. See also AnimationPlayer.Queue. Note: The signal is not emitted when the animation is changed via AnimationPlayer.Play or by an AnimationTree.

Handler parameters
NameTypeDefault
oldNameStringName—
newNameStringName—
CurrentAnimationChangedEvent
# CurrentAnimationChanged
C#
public event AnimationPlayer.CurrentAnimationChangedEventHandler CurrentAnimationChanged;

Emitted when AnimationPlayer.CurrentAnimation changes.

Handler parameters
NameTypeDefault
animNameStringName—

AnimationPlayer.AnimationMethodCallMode

ValueDescription
Deferred = 0
Immediate = 1

AnimationPlayer.AnimationProcessCallback

ValueDescription
Idle = 1
Manual = 2
Physics = 0
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.