1.3 KiB
1.3 KiB
AnimatorYarnCommand(Yarn 用法)
实现类:AnimatorYarnCommand.cs。命令经 AnimatorCenter 调用场景中已注册的 AnimatorHandler。
参数说明
- animatorName:与场景里
AnimatorHandler.animatorName一致。 - stateName:Animator Controller 里的状态名。
- addressableKey:Addressables 资源键中
Animation/之后 的部分(与AnimatorHandler加载逻辑一致)。
在 .yarn 里参数顺序与 C# 方法一致;含空格或中文时按项目 Yarn 版本加双引号。
命令一览
| 命令 | 是否等待结束 |
|---|---|
<<play_animation …>> |
会。等到 PlayAnimationAsync 完成(非 Loop 播完或 Loop 一整轮等,见 Handler 上配置)。 |
<<play_animation_addressable …>> |
会。加载控制器并播完本次流程。 |
<<reset_animation …>> |
否。立即 ResetAnimation。 |
<<hide_animation …>> |
否。关掉挂 Animator 的那层 GameObject,Handler 仍可留在场景里。 |
示例
把名称换成你场景里的注册名与状态名:
<<play_animation MyCutscene "手接树叶特写">>
<<play_animation_addressable MyCutscene "Test/手接树叶" "手接树叶特写">>
<<reset_animation MyCutscene>>
<<hide_animation MyCutscene>>