x


Ongui show/hide rendering weirdness

I'm drawing a gui using OnGUI, and have a keyboard shortcut for showing/hiding it. Toggling visibility causes some weirdness on 3d text-meshes using the standard GUI/Text Shader. Rendering of them changes, sometimes to a dark color, sometimes they disappear. It happens consistently in builds when toggling the GUI on/off, never in the editor: alt text

Has anybody encountered this?

I'm toggling by setting a bool in Update:

void Update() {
  if(Input.GetKeyDown(KeyCode.F1)) {
    showGui = !showGui;
  }
}

And drawing gui based on that bool:

void OnGUI() {
 if(showGui && allowGui) {
    GUI.skin = guiSkin;

    /* gui drawing code */
  }
}
more ▼

asked Jun 15 '10 at 10:13 AM

metervara gravatar image

metervara
171 10 12 20

Fixed with custom shader. Seems something in the built-in text shader is a bit funky. Changes are: ztest less (was always), zwrite on (was off), using constantColor [_Color] inside the pass instead of Color [_Color] outside. Not sure which of these did the trick...

Jun 15 '10 at 12:41 PM metervara
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3694
x510
x166
x162

asked: Jun 15 '10 at 10:13 AM

Seen: 1731 times

Last Updated: Jun 15 '10 at 10:13 AM