【问题标题】:Unity Animator - Have an animation at the start and end of a sceneUnity Animator - 在场景的开始和结束处有动画
【发布时间】:2018-09-10 09:50:46
【问题描述】:
我是 Unity 新手,我正在努力使用动画师创建一个简单的动画。我希望 GUI 在场景的开头和结尾有动画。入口动画为“NextLevelGUI”,退出动画为“FadeOut”。我尝试使用脚本启用的条件将 Any State 块连接到这些动画,但这不起作用。另外,我讨厌使用“空”动画,但我不希望有动画师控制的入口动画。只编写动画脚本会更好吗?
动画师形象
【问题讨论】:
标签:
c#
user-interface
animation
unity3d
animator
【解决方案1】:
使用脚本你需要做的:
public class BrandBtn : MonoBehaviour
{
public Animator _anim;
void Start()
{
_anim.Play("NextLevelGUI");
}
IEnumerator EndScene()
{
_anim.Play("FadeOut");
yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length+anim.GetCurrentAnimatorStateInfo(0).normalizedTime);
// Load next scene
}
}