Author Topic: 2D UI panel in strange place  (Read 2111 times)

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
2D UI panel in strange place
« on: August 28, 2014, 09:43:26 PM »
I've just updated to the latest NGUI. Since then a 2D UI panel is behaving very strangely.

I have a 3D UI and a 2D UI working together, both with UIRoot and UIPanel. The 3D UI is will working fine.

The 2D panel itself appears at a strange location and rotation, and at a massive scale.
Elements positioned within the panel appear in the camera correctly.
Elements anchored to the panel don't appear in the camera view.

But everything appears correctly when the game is run.

I created a new panel and re-setup all the anchors which worked until I restarted the program, at which point the same problem occurred in the new panel.

Not being able to see what I'm doing during editing is making it very difficult. Any ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UI panel in strange place
« Reply #1 on: August 28, 2014, 09:52:21 PM »
Where is the panel located and what is it anchored to? The recommended UI hierarchy is:

UIRoot
- UICamera
- UIPanels

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: 2D UI panel in strange place
« Reply #2 on: August 28, 2014, 11:28:59 PM »
I have 2 lots of:

UIRoot (with UIPanel script on it)
- UICamera

I managed to get it working properly again by centering everything, putting UI's in their own layers, and adjusting settings having read another post with a similar problem. Only thing is I'm not sure exactly which adjustment worked...

thanks :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UI panel in strange place
« Reply #3 on: August 30, 2014, 08:23:30 AM »
Each UICamera needs its own layer, so your "putting UIs in their own layers" is what did it.

kretin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: 2D UI panel in strange place
« Reply #4 on: August 31, 2014, 01:24:17 AM »
Gotcha. Thanks :)