Author Topic: GUI object being in front of NGUI  (Read 3547 times)

mukarillo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
GUI object being in front of NGUI
« on: May 29, 2014, 09:04:08 AM »
Hello guys, i'm doing this "gps" thing, and in every waypoint, there's a GUITexture being rendered on it's top.
Now i'm crating the interface for the project, and the GUITexture is on top of NGUI texture objects, is the anyway i can deal with that?

I'm using NGUI camera to render NGUI stuff and another camera to render the maps.

Thanks you guys very much,
Murillo.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: GUI object being in front of NGUI
« Reply #1 on: May 29, 2014, 10:16:08 AM »
The only way you can deal with it, is to have NGUI be drawn by a secondary camera, since GUITextures are always drawn on top by the camera with the GUILayer on it.

You could also move the waypoint to be done by NGUI as sprites or even UITextures, then it would layer as you would expect.

mukarillo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: GUI object being in front of NGUI
« Reply #2 on: May 29, 2014, 10:28:32 AM »
well, im doing that ( the camera part), but it still render on top of NGUI.
I don't want to use NGUI to render those icons, because the UNITYGUI rotates them for me and do all the dirty stuff.

Does anyone else knows something?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: GUI object being in front of NGUI
« Reply #3 on: May 29, 2014, 10:43:45 AM »
Make sure the camera depths are set correctly (with the NGUI camera having a higher depth than the on with the GUILayer on it) and make sure that the clear flags are set peroperly as well, so the NGUI camera doesn't hide the GUITexture completely.

Also make sure that the NGUI UICamera doesn't have a GUILayer component on it, as that would make it draw the GUITexture and GUIText above the NGUI elements.

mukarillo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: GUI object being in front of NGUI
« Reply #4 on: May 29, 2014, 04:17:42 PM »
Well... i don't know if this is what u mean (see in the attached photos). But it doesn't work :/


mukarillo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: GUI object being in front of NGUI
« Reply #5 on: May 29, 2014, 05:22:39 PM »
well... since it GUI.DrawTexture is not related to any camera or renderer, i couldn't find a way to do it.
I had to create some quads and place them by hand and rotate them in the Update according to the camera's rotation.

Thank you very much Nicki

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: GUI object being in front of NGUI
« Reply #6 on: May 30, 2014, 02:34:54 AM »
Oh! You're using the OnGUI system, I thought you were using GUITextures ( http://docs.unity3d.com/Manual/class-GuiTexture.html ). That's my bad for not following. Generally, don't use OnGUI for anything other than editor script is my best advice.

Glad to see you were able to solve your problem.