针对UI的Animator中的UI Animation的运用
网上看了这个版本https://blog.csdn.net/jx520/article/details/48678549
说是将那个speed设置为1为正着播放 -1为倒放
这个不是针对新版本的,在2018版本中你应该先
search_ani = searchingUI.GetComponent<Animator>(); search_ani.StartPlayback();
这么干才能设置-1和1,不然坑死你
private Button start_pipei;
private Transform searchingUI;
private Animator search_ani;
private bool isstart;
private void Awake()
{
isstart = true;
searchingUI = transform.GetChild(1);
search_ani = searchingUI.GetComponent<Animator>();
search_ani.StartPlayback();
start_pipei = transform.GetChild(0).GetChild(6).GetComponent<Button>();
start_pipei.onClick.AddListener(BeginPipei);
}
private void BeginPipei()
{
if (isstart)
{
search_ani.speed = 1;
isstart = false;
}
else {
search_ani.speed = -1;
isstart = true;
}
}