- Home /
guiText before guiTexture
Hello everyone, I have guiText in my scene, and when player clicks to right mouse button, my guiTexture appears. But when guiTexture appears it takes place in front of the guiText so guiText becomes invisible. ( it's behind the guiTexture which covers all of the screen ) So I simply want my guiText visible when guiTexture is activated. How can I do that, I tried dealing with it's Z but it didn't work.
Any ideas ? Thanks :)
Answer by Eric5h5 · Jan 22, 2012 at 09:23 PM
Using the z position is correct, and does work. A lower z will appear on top of a higher z.
but I can't adjust the Z of my guiTexture, it's actually not guiTexture I meantioned it in wrong way, it's just a texture which is being drawn to the main camera when the player clicks to the right mouse button. So I only can adjust the guiText's Z but it doesn't work.
If you're talking about OnGUI code, then that's always drawn on top of everything and can't be changed. Use GUITexture ins$$anonymous$$d.
Um yes that's what I meant, my code for drawing the texture is :
function OnGUI(){ if(CanShowScopeTexture==true) {
GUI.DrawTexture(rScope, texScope, Scale$$anonymous$$ode.ScaleToFit, true, 0);
}
}
so what should I do to draw it in other way that you told ?
Your answer
![](https://koobas.hobune.stream/wayback/20220613063257im_/https://answers.unity.com/themes/thub/images/avi.jpg)