Pigeon shit

[ Pigeon shit ] Unity UI fading part 2

ScreenHunter_49 Oct. 26 18.43


This evening I made the Game over screen, and here I also wanted to have a fade in/out of the screen. Earlier with the playerscore in the HUD I used crossfade but calling that for each and every object on my gameover screen just feels weird and I knew there had to be a better solution. So after looking around the net I found out about the Canvasgroup component. When you add the component to a gameobject and child every canvas object to it, you can adjust the alpha value on the Canvasgroup component and it will automatically adjust all alphas of each and every child! nice. Exactly what I was looking for. After that I made a little script called CanvasFade and used Coroutines to do the fading(adjusting of the alpha over time).