在先前的动画播放完毕后再播放动画。
例如,您可能会按指定的序列一个接一个地播放动画。
该动画状态在播放前会自我复制,因此您可以在相同动画之间淡入淡出。
这可用于覆盖两个相同动画。例如,您可能有一个挥剑的动画。
玩家在将剑挥来挥去后快速猛砍两下。
您可以将该动画倒回,从头开始播放,但之后您会看到动画有跳帧现象。
以下队列模式可用:\
如果 queue
为 QueueMode.CompleteOthers,则仅在其他所有动画均已停止播放后,该动画才会开始。\
如果 queue
为 QueueMode.PlayNow,则该动画将在复制动画状态下立即开始播放。
动画播放完毕后,将自动执行自我清理。在该动画播放完成后使用复制动画状态将导致异常。
using UnityEngine;
public class Example : MonoBehaviour { void Start() { Animation anim = GetComponent<Animation>();
//Queues each of these animations to be played one after the other anim.PlayQueued("CubeBob", QueueMode.CompleteOthers); anim.PlayQueued("CubeFlip", QueueMode.CompleteOthers); anim.PlayQueued("CubeShuffle", QueueMode.CompleteOthers); } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.