Why isn't CrossFadeAlpha working during a fade in?

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);
            }
        }
    }
}

I suspect the alpha value is expecting a normalised value (0-1) same as the Color class.

1 Like

I just tried 1f, 1.0f and 1 and none of them work :s