GUI opacity.

Two questions.

  1. Does OnGUI() update every frame like Update();?

  2. Is there a way I can remove a GUI element or even better set the opacity(I could not find anything in the scripting reference)

THANK YOU!

OnGUI updates multiple times per frame (one of the reasons it is slow and soon to be replaced). OnGUI gets called for layout, repaint and for each mouse messages, key press etc.

To remove an element, just don’t include it! In other words put an if(something) {} around it.

You can set the GUI.color property to a transparent flavour of white before drawing the item and reset it afterwards to make it appear transparent/semi transparent (plus of course you could colour it something else entirely).

  GUI.color = new Color(1,1,1,0.5f);
  if(shouldDraw)
  {
      if(GUILayout.Button("I'm not all there"))
      {
      }
  }