using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(TextMeshProUGUI))] public class SinAlphaText : MonoBehaviour { [Range(0, 1)] public float amplitude = 0.5f; public float speed = 1; TextMeshProUGUI label; int a; private void Start() { label = GetComponent(); } void Update() { Color c = label.color; c.a = amplitude + amplitude * Mathf.Sin(Time.time * speed)/2; label.color = c; } }