Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: NateJC on May 18, 2014, 10:22:41 PM

Title: UIWrapContent dynamic Item Width & 2d+3d content
Post by: NateJC 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 (https://www.dropbox.com/s/c7haw29iadfoi3i/MissionSelectScreen.png)). 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 (https://www.dropbox.com/s/k2jplwt6g0zcjnd/AnchorsWrong.png), 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 (https://www.dropbox.com/s/jx38458v77k3r0l/UIWrapContentWidthWrong.png).

Any suggestions? Am I approaching this completely wrong?
Title: Re: UIWrapContent dynamic Item Width & 2d+3d content
Post by: ArenMook 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.
Title: Re: UIWrapContent dynamic Item Width & 2d+3d content
Post by: NateJC 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!