using UnityEngine; using UnityEngine.UI; using System.Collections; public class BattleInfoItem : MonoBehaviour { public Text text; public Animator animator; private float startTime; private float duration = 5f; // Use this for initialization void Start () { startTime = GameTime.time; } // Update is called once per frame void FixedUpdate () { if(GameTime.time - startTime > duration) { animator.Play("BattleInfoItemHide"); Destroy(this); } } }