Author Topic: How to render gizmos only on scene's main camera, and not on UI camera?  (Read 8199 times)

Antti

  • Guest

How to render gizmos only on scene's main camera, and not on UI camera?

If I draw debug gizmos for my game, intended to be rendered only by the "game" camera, they seem to be rendered with the NGUI's camera too, no matter if the NGUI's camera is enabled or what the layers / culling masks are.

I'm using the evaluation version of NGUI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #1 on: October 26, 2012, 06:31:52 AM »
Gizmos aren't rendered by cameras. They are rendered by Unity.

Antti

  • Guest
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #2 on: October 29, 2012, 05:31:19 AM »
Gizmos aren't rendered by cameras. They are rendered by Unity.

Yes, and the best way to handle the issue seems to be the workaround suggested on this thread:

http://forum.unity3d.com/threads/117743-Gizmos-are-drawn-to-all-cameras

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #3 on: October 29, 2012, 05:33:09 AM »
Why would you have gizmos shown by your game camera to begin with?

Antti

  • Guest
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #4 on: October 29, 2012, 05:37:04 AM »

For debug visualization. E.g. to visualize the state of our custom path finding component.

dlewis

  • Guest
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #5 on: October 29, 2012, 05:38:36 AM »
We had the same problem in our game...We ended up just moving the UI 100 units down (below the world) so that the UI camera didn't see the gizmos.

Antti

  • Guest
Re: How to render gizmos only on scene's main camera, and not on UI camera?
« Reply #6 on: October 29, 2012, 05:44:15 AM »
We had the same problem in our game...We ended up just moving the UI 100 units down (below the world) so that the UI camera didn't see the gizmos.

Thanks, that might be even better than the workaround, as it requires no extra code.