Set up animations

BeginnerDesignerProgrammer

After you import animation assets, you need add them to an entity and play them with a script.

1. Add animation assets to an entity

  • In the Scene Editor, select the entity you want to animate.

Select an entity

Note

To animate an entity, the entity must have a model component.

  • In the Property Grid, click Add component and choose Animations.

Select an entity

Game Studio adds an animation component to the entity.

  • In the animation component properties, next to Animations, click Green plus button (Add) to add a new animation to the library.

  • Type a name for the animation and press Enter.

Add animation

Tip

When you play animations using scripts later, you use this name, not the name of the animation asset. To make identification easy, we recommend you give your animation the same name as the animation asset.

  • Click Hand icon (Select an asset).

Pick asset up

The Select an asset window opens.

  • Browse to the animation asset you want to add and click OK.

Select an asset

Game Studio adds the animation asset to the entity.

Animation asset added

You can add as many animations to the animation component as you need. The Property Grid lists them in alphabetical order.

Animations list

2. Create a script to play the animations

After you add animations to an entity, you need to play them with a script.

Example script

  1. public class SimpleAnimationScript : StartupScript
  2. {
  3. public override void Start()
  4. {
  5. Entity.Get<AnimationComponent>().Play("Walk");
  6. }
  7. }

This script looks for an animation with the name Walk under the animation component on the entity.

For more information about creating animation scripts, see animation scripts.

3. Add the script to the entity

  • In the Scene Editor, select the entity you want to animate.

Select an entity

  • In the Property Grid, click Add component and choose the animation script you want to add.

Select an entity

Game Studio adds the script as a component. You can adjust public variables you define in the script in the Property Grid under the script component properties.

Select an entity

See also