Author Topic: Sprites appearing twice in Camera view  (Read 2438 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Sprites appearing twice in Camera view
« on: May 22, 2012, 10:54:35 PM »
Ok, not sure how to explain this, or how to fix it.

I have my NGUI Hud all working etc in the game, except that I can see it again twice rendered extremely small in the centre of the screen. I have fiddled around the camera to try and restrict the draw distance but the tiny dots in the center do not vanish, although I can get the HUD I want to see to vanish using various draw distance settings.

I think the problem lies in that I have two cameras. The main camera lies within a game already being written in Unity and I added my NGUI created HUD into it. I didn't notice it at first because I have been developing in a separate scene. If I move the HUD for example to -10000 in the X direction the HUD stays fixed on the screen but moves about 10 pixels to the left in the centre of the window.

Any ideas on what could be causing this?

Thanks.

dlewis

  • Guest
Re: Sprites appearing twice in Camera view
« Reply #1 on: May 22, 2012, 11:30:36 PM »
NGUI makes real geometry for the UI so it is actually in the scene. The reason it's drawing twice is the geo for the UI is being seen by the UI camera and the game camera.

What I did was make sure all the UI was built on a specific UI layer/s and then have the game camera ignore/cull those layers. This results in the UI camera seeing and drawing the UI but the game camera doesn't see it and thus doesn't draw it. Don't forget to make sure you set the UI camera to see the UI layer!

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Sprites appearing twice in Camera view
« Reply #2 on: May 23, 2012, 12:02:36 AM »
Dude, that was exactly what I was looking for. Fixed it straight away. Thanks a lot dlewis, you are the man!  ;D (or woman)

dlewis

  • Guest
Re: Sprites appearing twice in Camera view
« Reply #3 on: May 23, 2012, 01:35:00 AM »
you are the man!  ;D (or woman)

Most definitely the former ;)