Two GameObjects with GUITexture. How do I Z sort?

Hi everyone!

I’ve got an iPhone finger joystick like the Penelope tutorial, and I want to place a grey square behind it to denote the borders the joystick will move. I made a grey graphic and made another GameObject with a GUITexture component. Unfortunately, this grey square appears in front of the Joystick, instead of behind it. Is there a good way to Z-sort these two items?

Thanks!

Unless I am mistaken :

  • You have two gameObject.
  • Each game Object has a GUI Texture.
  • You want to set one of the game Object in front of all others.

Solution : increase its Z value, in its Vector3 Transform Position.

There is no code on the background square, it is simply a Game Object with a GUI Texture component added to it. In the inspector I can change the pixel offset, but not the Z depth

The game object…it has a Transform component, right ?

This component has a Position value, right ?

Set the Z position higher, and look.

Perfect. Thank you!