Advertisement
DeltaLeeds

Untitled

Jun 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class FloatingText : MonoBehaviour {
  6.     public Animator animator;
  7.     private Text damageText;
  8.  
  9.     void OnEnable()
  10.     {
  11.         AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(0);
  12.         Debug.Log(clipInfo.Length);
  13.         Destroy(gameObject, clipInfo[0].clip.length);
  14.         damageText = animator.GetComponent<Text>();
  15.     }
  16.  
  17.     public void SetText(string text)
  18.     {
  19.         damageText.text = text;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement