下面是我的脚本,我想检查一下动画师状态是否完成。如果动画制作者状态(动画)完成,那么请执行一些操作,但我可以这样做,谢谢。如何检查动画师状态完成unity3d
using UnityEngine;
using System.Collections;
public class fun_for_level_complet : MonoBehaviour
{
public Animator animator_obj;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
check_end_state();
}
public void level_complete()
{
if (this.GetComponent<movement_of_player>() != null)
{
this.GetComponent<movement_of_player>().enabled = false;
}
animator_obj.SetBool ("congo",true);
}
public void check_end_state()
{
// here I want to check if animation ends then print
// my state name is congo
// animation name Waving
// using base layer
if (animator_obj.GetCurrentAnimatorStateInfo (0).IsName ("congo") && !animator_obj.IsInTransition (0))
{
Debug.Log ("anim_done");
}
}
}
@RiaanWalters这就是动画。 OP正在使用Animator。他们都不同。 – Programmer
@程序员,够了,我删除了国旗 –