I keep running my game and the UI turns invisible every time. There’s nothing in my code that could be doing this. The problem might have to do with a image covering the entire canvas but the image is full alpha. There is no way that one image could make the rest invisible. And no the other bits of the ui are not children of the big image. I think this is a bug because it fixes every time i re-import assets…but then it breaks again. Plz help.
Ok so for some weird reason…i think this script made the problem. as soon as i took it off the problem stopped. Heres the script.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Fade : MonoBehaviour
{
public float alpha = 0.1f;
public Color color;
public GameObject fadeOutObject;
public bool triggerFade;
public float fadeOutSpeed;
void Update ()
{
if (triggerFade == true)
{
alpha += fadeOutSpeed;
}
color.a = alpha;
fadeOutObject.GetComponent<Image>().material.color = color;
}
}
i dont know if this is the actual cause but i think for now i will hold off on the fade script
From the script you showed, there is:
public float alpha = 0.1f;
then inside Update, you have
color.a = alpha;
fadeOutObject.GetComponent<Image>().material.color = color;
that makes the object faded I think