Table of Contents

Class AnimationComponentExtensions

Namespace
Stride.CommunityToolkit.Engine
Assembly
Stride.CommunityToolkit.dll

Provides extension methods for the AnimationComponent to enhance animation playback functionality.

public static class AnimationComponentExtensions
Inheritance
AnimationComponentExtensions

Remarks

These extensions simplify the process of controlling animations, such as checking if an animation is already playing before starting it.

Methods

PlayAnimation(AnimationComponent, string)

Plays the specified animation on the animation component if it is not already playing.

public static void PlayAnimation(this AnimationComponent animationComponent, string name)

Parameters

animationComponent AnimationComponent

The AnimationComponent on which to play the animation.

name string

The name of the animation to be played.

Remarks

This method first checks if the animation with the given name is already playing. If it is not, the animation will be started. This approach prevents restarting an animation that is currently running, allowing for smooth transitions between animations.