Author Topic: UIWrapContent dynamic Item Width & 2d+3d content  (Read 1811 times)

NateJC

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
UIWrapContent dynamic Item Width & 2d+3d content
« on: May 18, 2014, 10:22:41 PM »
Goal:
I'm trying to setup a wrapping scrollable level select screen that is a combination of 3d elements (the room the player is standing in) and 2d elements (the contents of the in-game computer screen which can be swiped & tapped to select a level).

Current status:
I have a 3d camera properly setup showing the right view. I have a UI Root and UICamera setup, which contains a Scroll View & Grid (which has a UIWrapContent attached to it). The UICamera is not actually used to render anything at all, but I wasn't sure if I could get rid of it since I think it needs the UICamera Script to make all of the rest of the NGUI stuff function properly.

Problems:
Everything works great with the perfect screen size & resolution (preview here). But once the resolution changes, I have two problems:
1) If the resolution gets small, the ScrollView size (anchored to UI Root) shrinks too much (preview here, note the bad black borders).
2) If the resolution gets big, the Sprites in the grid start overlapping (I'm guessing because of fixed grid/UIWrapContent width?), which you can see here.

Any suggestions? Am I approaching this completely wrong?
« Last Edit: May 20, 2014, 04:30:03 PM by NateJC »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent dynamic Item Width & 2d+3d content
« Reply #1 on: May 19, 2014, 05:12:21 PM »
How are you drawing 3D elements in your UI? You should be rendering them into a texture, then drawing the texture like any other UI element using UITexture.

NateJC

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIWrapContent dynamic Item Width & 2d+3d content
« Reply #2 on: May 20, 2014, 04:30:42 PM »
I just switched everything to a single 3d NGUI camera and got rid of the anchors. This fixed it. Thanks!