Skip to content

Instantly share code, notes, and snippets.

@allfake
Created June 21, 2022 11:22
Show Gist options
  • Save allfake/02f700a9bcbfb0499c82d25a2ca09986 to your computer and use it in GitHub Desktop.
Save allfake/02f700a9bcbfb0499c82d25a2ca09986 to your computer and use it in GitHub Desktop.
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
namespace Scripts.Utils
{
public class AutoFadeImage : MonoBehaviour
{
public Image image;
public float fadeTime = 0.25f;
public float delayTime = 0.25f;
public void Awake()
{
image.gameObject.SetActive(true);
}
public void Start()
{
image.gameObject.SetActive(true);
image.DOFade(0, fadeTime).SetDelay(delayTime).onComplete = () => { image.gameObject.SetActive(false); };
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment