Search code examples
user-interfaceunity-game-engineguitexture

How to send GUI texture behind a image having sprite renderer component in unity3D 4.5


I am making buttons with GUI Texture and need them to adjust on white (Transparent) portions of below image. By default these GUI Texture appears above/on the image. I need them to appear under/below the image to achieve actual look.

enter image description here

What I need to achieve:

what i need to achive

Current state I am stuck with:

enter image description here

Please guide me how to achieve actual look if someone understands what I need. Thanks.


Solution

  • GUITexture is only control z position. By default, more large z value is more up to draw.

    Or You can use sorting layer/order if you can use sprite renderer or other GUI engines like UGUI. Of course, some GUI engines sometimes support there own depth properties.

    UGUI also support clipping mask and of course you can implement masking or clipping shader too.