Alternate Fade Transitions Code

I did the same way. Just added “SetActive” function after watching a video but I used Invoke to call it, because for some reason it didn’t fade in all the way through before panel was disabled. Here is my code:

public float fadeTime = 5f;

void Start () {
	GetComponent<Image>().CrossFadeAlpha(0f, fadeTime, false);
	Invoke ("SetAsInactive", fadeTime);
}

void SetAsInactive(){
	gameObject.SetActive(false);
}
3 Likes