Author Topic: UIPanel wrong camera detect when Init  (Read 5452 times)

markofevil3

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
UIPanel wrong camera detect when Init
« on: September 18, 2015, 04:43:43 AM »
Hi,
I have 2 camera using for NGUI. When I add new Panel to scene, it's alway use camera which is nearest in hierarchy, not the one i'm aiming to. For example:
UIRoot
 - Camera1
   - UIPanel1
   - UIPanel2
     - Camera2
UIPanel1 will alway use Camera2 to draw rect, but what i want is Camera2.
I found out that camera will be detect using NGUITools.FindCameraForLayer.
Is there any way choose camera for UIPanel?
Thank you.

 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel wrong camera detect when Init
« Reply #1 on: September 20, 2015, 02:53:45 AM »
Why would you put a camera underneath a panel? Cameras should not be underneath anything other than UIRoot, if that.

UIRoot
- Camera 1
- Camera 2
- Panel 1
- Panel 2

Note how flat the hierarchy should be. Also if you have different cameras, they should be drawing different layers. You shouldn't have two cameras drawing the same layer. I am not sure what you are trying to do here...