Animator

Is ok if I used the animator for the fade transition?

Of course you can, but it’s somewhat more work for something you can do in a simpler way with the script.

Read this btw: CanvasGroup For Fading? - I think it’s the best solution for the fade.

I believe that:

image.CrossFadeAlpha(0f, 3f, false);

and disabling “Raycast Target” on the panel so that the buttons are interactable from the beginning would be the most elegant solution.
(Unity 5.5, not sure about the older versions)

Another option is to use the canvas group. I created a GameObject (Panel) than included the canvas group and controlled the fade though the StartCoroutine using a while loop. This line controls the alpha with a private variable fadeTime once the alpha reaches 0 I set the canvasGroup.blocksRaycasts to false.

canvasGroup.alpha -= Time.deltaTime / fadeTime;

Not sure if this is the more elegant solution but I found that it works well and I have more control over its effects.
Unity 5.4 or higher

Privacy & Terms