Changing GUI.Box opacity

How do you change the opacity of a GUI.Box? Is it even possible?

Hey There,

All you have to do is go

GUI.Color = new Color(1.0f, 1.0f, 1.0f, 0.5f) //0.5 is half opacity 


GUI.Color = Color.white;

Unity is a state machine so you want to set it back to white when you are done. This GUI.Color effects every GUI element.


If you want to change the default GUI.Box you will need to create your own GUISkin inside of the unity editor. Once you have done that click on it and at the top in the inspector window you will see box, change the values of the colors for whatever options you would like. Once you have done that whatever script you are using for GUI, add a holder to put your GUISkin in and in your OnGUI class add = myGUI;

You can make the box more transparent using the opacity in a GUI.Color.

However, to increase the opacity (which is otherwise limited to the opacity of the Box texture image), you can avoid making a new box image and skin by calling the same GUI.Box rectangle multiple times. For example, call the GUI.Box twice and you double its opacity.

function OnGUI () {
GUI.Box (Rect (0, 0, Screen.width/7, Screen.height/1), "");
GUI.Box (Rect (0, 0, Screen.width/7, Screen.height/1), "");

I also posted this hack here: