public void FadeOutUI(GameObject obj, float time, float delay, iTween.EaseType easetype = iTween.EaseType.easeOutCubic) { FadeGui fadeGui = obj.GetComponent <FadeGui>(); if (fadeGui == null) { fadeGui = obj.AddComponent <FadeGui>(); obj.GetComponent <CanvasGroup>().alpha = 1f; } fadeGui.FadeOut(time, delay, easetype); }
// gui public void FadeInOutUI(GameObject inObj, GameObject outObj, float time, float delay, iTween.EaseType easetype = iTween.EaseType.easeOutCubic) { FadeGui fadeGuiIn = inObj.GetComponent <FadeGui>(); if (fadeGuiIn == null) { fadeGuiIn = inObj.AddComponent <FadeGui>(); inObj.GetComponent <CanvasGroup>().alpha = 0f; } FadeGui fadeGuiOut = outObj.GetComponent <FadeGui>(); if (fadeGuiOut == null) { fadeGuiOut = outObj.AddComponent <FadeGui>(); outObj.GetComponent <CanvasGroup>().alpha = 1f; } fadeGuiIn.FadeIn(time, delay, easetype); fadeGuiOut.FadeOut(time, delay, easetype); }