using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class UIDamageIndicator : MonoBehaviour { public TMP_Text damageText; public float moveSpeed; public float lifetime = 3f; private RectTransform myRect; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { Destroy(gameObject, lifetime); myRect = GetComponent(); } // Update is called once per frame void Update() { myRect.anchoredPosition += new Vector2(0f, -moveSpeed * Time.deltaTime); } }