I’m using GUILayout to create an options screen. Essentially, this is a second camera in the scene, cull-masking the necessary layers.
The secondary (disabled) camera is on an “options” layer and masking only 2 visible layers (default and options).
The main camera is in a “main-only” layer and set to render all layers except for “options”.
I have a script attached to each camera
- Main Camera script creates a few GUI Textfield elements
- Options Camera script creates a few GUILayout buttons.
When I run the application, the main camera displays the buttons that were rendered in the Option camera script. When I go to my options (by hitting ESC), the textfields in the main camera script are still there. If it wasn’t for a GUI texture which is also on the main-camera layer, I would think this wasn’t’ working at all, but the Option Camera does not show the texture, so it’s working somewhat… I just can’t filter out objects that I create in OnGUI.
I thought some sort of inheritance would have played a part since the script was attached to an object (camera) that was in the correct layer. I simply can’t find a way to send a OnGUI created element to a target layer.
Can someone point me in the right direction for this?
Thanks for any info!