Created
June 21, 2022 11:22
-
-
Save allfake/02f700a9bcbfb0499c82d25a2ca09986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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