So I can do a fade out just fine but when I try to set the alpha to fade in then it doesn’t work. I also tried manually setting the alpha to 0. As well as setting the alpha to 1(As on a 0-1 scale) and just 255 (as a int) and nothing works. Can someone point me to the issue please? Thanks.
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;
public class FadeManager:MonoBehaviour {
public Text TextToFade;
public Canvas TransitionalCanvas;
private float TotalTimeLeft;
private float StartingTotal;
private bool StartedTransition;
public float FadeDuration;
public float HoldTransition;
void Start() {
TransitionalCanvas.enabled=false;
TextToFade.enabled=true;
TotalTimeLeft=FadeDuration*2+HoldTransition;
StartingTotal=TotalTimeLeft;
Debug.Log(StartingTotal);
Debug.Log("Started");
}
void Update() {
TotalTimeLeft-=Time.deltaTime;
if(TextToFade.enabled==true) {
TextToFade.CrossFadeAlpha(255.0f,FadeDuration,false);
if(TotalTimeLeft<=StartingTotal-FadeDuration) {
Debug.Log("It should be appearing by now! "+TotalTimeLeft);
}
}
}
}