GM2 Depth values

This is driving me crazy…
No matter what I set in the MDepth parameters of the GUIQuadObj script instances, my UI elements are not sorted the way I want.

For instance, I have a GUIQuadObj displaying a background using a GUITextureObj, and on top of that background, I want to have 2 buttons using GUIQuadObj and the atlas texture.
I set the depth of the background to 5, and the depth of the buttons to 4 (I have tried all combinations), however the background insists on rendering above them.

Is there something more to it?

Update:
It seems that the depth order applies for QUIQuadObj renderered with the texture atlas. If I render a GUITextureObj, it ignores the depth, and renders at the top of everything.

Anyone?

Hi alkisbkn. You’re correct. Depth only applied to GUIQuadObj. The GUITextureObj and GUITextObj are basically a wrapped version on Unity’s GUITexture and GUIText object. These Unity objects always render on the top. This is the reason why the GUIQuadObj was created. Also, using the Unity objects costs 1 drawcall for each object used. To save on drawcalls, the GUIQuadObj combines all quads together into a single draw call. If you have any other questions, please post in the GM2 thread. I try to pop on to that once in a while to answer questions.

Hi besuser,
The MDepth changes the scale of object too. What is the reason? In my case I need to render icon (GUITextObj) over the button (GUIQuadObj). The coordinates and scales are absolutely different for this objects. What is the GM way to do what I need?

P.S. Forget I found workaround. Thanks