Author Topic: 2D UiRoot, not scaling to match the 3D Main Camera Help  (Read 1675 times)

lastkingssaint

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
2D UiRoot, not scaling to match the 3D Main Camera Help
« on: December 20, 2016, 10:20:13 AM »
Hello Everyone,
I have an issue that I am stuck on. I have 2 cameras in my scene, a normal 3D camera for displaying 3d objects and then a UIRoot component with its own camera, for handling UI stuff. The issue that I am having is that I cannot get the UIRoot to scale to meet the size of the 3D Camera.

Looking through the forums I have found this advice:
Check your layers, clear flags and camera's depth.
UI camera should only see the UI layer, while your game camera should not see the UI layer.
Your UI camera should have a higher depth than your game camera.
Your UI camera should have its clear flags set to "Depth".

I have done all of these and still the UIRoot Camera will not match the size of the 3D camera. The Ui root is in the center but not scaled to the outside corners.

Any idea on how to fix this issue? I really love using Ngui, its the last problem that I am having the most trouble with.

Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UiRoot, not scaling to match the 3D Main Camera Help
« Reply #1 on: December 20, 2016, 01:45:33 PM »
You won't be able to get a 2D camera to match a 3D one perfectly, as the 3D one has an extra dimension. Either use 3D, or 2D UI elements. If you need to display a 3D object on a 2D UI, simply use render textures displayed by a UITexture.

lastkingssaint

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: 2D UiRoot, not scaling to match the 3D Main Camera Help
« Reply #2 on: December 21, 2016, 08:38:38 PM »
Ok thank you,

I changed my root to a Root 3d, and that seems to work.
Now i have an issue where none of my buttons are clickable. I copied the panels and buttons from the root2d panel. Is there something that I am missing? Maybe i just have to rebuild all of the UI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UiRoot, not scaling to match the 3D Main Camera Help
« Reply #3 on: December 24, 2016, 11:09:10 PM »
Check your event type. 3D UI is different from 3D World events, as ones go to colliders (UI) and others to rigidbodies (world).