using DG.Tweening; using UnityEngine; using UnityEngine.UI; public class ImageBlinker : MonoBehaviour { public float blinkDuration = 0.1f; private void OnEnable() { Image targetImage = transform.GetComponent(); // 重置alpha值 Color tempColor = targetImage.color; tempColor.a = 1f; targetImage.color = tempColor; // 执行闪烁动画 targetImage.DOFade(0, blinkDuration).SetSpeedBased().SetLoops(-1, LoopType.Yoyo) .SetEase(Ease.InOutSine); } }