Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Animation.Play 播放
# [Animation](Animation.html).Play 播放 function *Play* (*mode* : [PlayMode](../Enumerations/PlayMode/PlayMode.html) = [PlayMode.StopSameLayer](../Enumerations/PlayMode/PlayMode.StopSameLayer.html)) : bool function *Play* (*animation* : string, *mode* : [PlayMode](../Enumerations/PlayMode/PlayMode.html) = [PlayMode.StopSameLayer](../Enumerations/PlayMode/PlayMode.StopSameLayer.html)) : bool *Description* 描述 Plays animation without any blending. 没有任何混合的播放动画。 Play() will start animation with name animation, or play the default animation. The animation will be played abruptly without any blending. Play()将开始播放名称为 animation 的动画,或者播放默认动画。动画会突然开始播放而没有任何混合。 If mode is PlayMode.StopSameLayer then all animations in the same layer will be stopped. If mode is PlayMode.StopAll then all animations currently playing will be stopped. 如果模式是 PlayMode.StopSameLayer,那么所有在同一个层的动画将停止播放。如果模式是 PlayMode.StopAll,那么所有当前在播放的动画将停止播放。 If the animation is already playing, other animations will be stopped but the animation will not rewind to the beginning. 如果动画已经在播放过程中,别的动画将停止但是动画不会回退到开始位置。 If the animation is not set to be looping it will be stopped and rewinded after playing. 如果动画没有被设置成循环模式,它将停止并且回退到开始位置。 Play() will return false if animation can't be played (no animation clip or no default animation). 如果动画不能被播放(没有动画剪辑或者没有默认动画),Play()将返回 false。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public void Awake() { animation.Play(); } } ``` ``` // Plays the default animation // 播放默认动画。 animation.Play(); ``` For a specific animation, you can call the animation with play as well. 对于特别的动画,你也可以调用 Play 来播放动画。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public void Awake() { animation.Play("walk"); animation.Play("walk", PlayMode.StopAll); } } ``` ``` // Plays the walk animation - stops all other animations in the same layer // 播放walk动画 - 停止同一层的其他动画。 animation.Play("walk"); // Plays the walk animation - stops all other animations // 播放walk动画 - 停止其他动画。 animation.Play("walk", PlayMode.StopAll); ```
da
2022年5月13日 22:08
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码