format
typescript
Animation.AddClip(clip, name, setting)class: Animation
description
Add an animation clip (AnimationClip) to the Animation component. With this method, you can add an animation clip to the Animation component and specify a unique name. This allows you to reference and play the animation clip by its name in subsequent code.
parameter
| param_name | type | description |
|---|---|---|
| clip | AnimationClip | The animation clip to add. |
| name | string | The name of the new animation clip. |
| setting | AnimationPlaySetting? | The animation playback settings. |
reture
| type | description |
|---|---|
void |
code example
typescript
let obj = new GameObject();
let animation = obj.AddComponent<Animation>(Animation);
let uuid = "31A9092E126B4B19BBFD9D5FCD75AA49";
let clip = Resources.Load<AnimationClip>(AnimationClip, uuid);
animation.AddClip(clip,"newClip");