Fadeing GUI created in OnGUI()


I have a game where I am fading the scene to make smooth transactions, but the GUIButtons, GUIBoxes, etc. created WITH function OnGUI are not fading away(currently using this script Fade).

I managed to find a script here, but it was in C# even if I managed to fit it into my game I would not fully understand it and therefor I would not be able to create my own in the future as I do not like to rely on others and go search for scripts. I will rather much create my own and make them suite my needs.

So if you know a way of fading away GUIBoxes and buttons created with the function OnGUI(), it would be very much appreciated.

Change the value of GUI.color.a over time. Usually you’d set GUI.color before a button (or whatever) and reset it afterward.