Placing a second viewport over GUI elements

Hello, I really hope someone can help me with this one.

Here’s my problem:

My project has two viewports. The main one and a picture-in-picture. The main one has a GUI Layer.

How do I prevent the GUI elements (positioned via worldToScreen) in the main viewport from overlapping the smaller picture-in-picture viewport?

I have tried:
a - disabling the GUI Layer in the small viewport
b - using the “depth” parameters

Thanks a lot you all!

I did this a while back and if you are insistent upon using onGUI (as opposed to GUIText or GUITexture), then you can not draw 3d stuff over it.

Though you can use a background image that has a transparency… So, if your background for the onGUI is a 32 bit PNG with a hole in it in the place where your picture-in-picture camera is located, then that other camera will appear to be on top.

Hello Mike, Thanks for helping!

I’ll try the transparent background image trick… unfortunately, I need the onGUI (so I can use them as buttons).

Again, thanks a lot for replying. Much appreciated!