Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mahewitt

Pages: [1]
1
NGUI 3 Support / Position UIPanel In Camera
« on: November 01, 2014, 04:22:39 PM »
Hi,

How are UIPanels linked to the camera?
I have 2 camera's and one of my UIPanels seems to insist on following the wrong camera.

So in the below, GameMenuPanel seems to wrongly follow UI Root2 and placed as such in the design mode even though position is set to 0,0,0.

-UI Root1
-- Camera1
-- GameMenuPanel
-- ..
-UI Root2
-- Camera2
-- MessagePanel
-- ..

Thanks for the help,
Mark

2
Layout should be ok. Only UIRoot is offset. NGUI Camera and Panel nested under UIRoot.

I did a simple test and duplicated the offending Panel and surprisingly that seems to behave correctly. All settings (Transform etc) look the same on both. If you see the new screen shot you see the original and duplicates where the latter is how things were before the upgrade.

Is there some 'hidden' setup that defines how these are placed (that I can perhaps update somehow). I possibly have a workaround now based on the above however to get the GUI back as it was.

Thanks  :)

3
Thanks for the reply.

Probably need to rephrase a bit. In the picture the NGUI camera is on the small collection of objects at the top, . The 'pink' rectangle seems to be positioned over the main camera (on different Layers) and the UIRoot dimensions (Flexible, min 1080, max 1536). Before upgrading this was overlaid the NGUI camera and seemed to use the game window size. Before the tiny button (top left of game scene) appeared the same as the 3 absolute positioned buttons (not using anchors).

It all works out correctly runtime, but makes things tricky when setting up the gui in design mode.

Camera is child of UIRoot, UI Root is positioned at 0,20. Pink rectangle seems centered on 0,0.

Any ideas?

4
NGUI 3 Support / Design view rendered wrongly after upgrade from 3.6.8
« on: August 25, 2014, 02:58:31 PM »
Hi.

After upgrade from 3.6.8 my design time view seems messed up (things are ok run time).

Previously I worked from within the small camera area you see at the top of the scene view. If things are fixed position they appear fine in game view (the 3 big panels and debug buttons). There is a button top left and text that now however appear minute in game view (design mode) that use anchors to their parent panel for position. These appear fine however when running the game.

Any ideas how to fix this? Previously the panel was overlaid and sized to the NGUI camera in design mode also but that now doesn't seem to be the case.

Thanks,
Mark

5
I am trying to create a Pixelperfect GUI that will work across all resolutions. Practically fixed size seems to handle different resolutions easiest but without pixel perfect. You can work around this by increasing the UIRoot manualheight in fixed size mode as the resolution increases. Applying a scale factor to this for the different atlases then allows for have a larger pixel sized button for higher resolution textures. This keeps a fixed size output for each atlas across the target range and then allows for switching size when you have a new range / atlas.

A test script is included below. Putting this in Update() seems to work well in the editor when you resize the game window. Is this a valid way of doing things? I see there is a new Adjust by DPI setting, but I am unsure the differences with that and my method and how to simulate this without access to many different devices. Would it also work for all DPI's (or DPI ranges), or just a few key targeted ones?


   void Start() {
      int manualHeight;
      if (Screen.height >= 1080) {
         atlasRef.replacement = Resources.Load ("TestAtlas4x", typeof(UIAtlas)) as UIAtlas;
         manualHeight = (int)Screen.height;
      } else if (Screen.height >= 640) {
         atlasRef.replacement = Resources.Load ("TestAtlas2x", typeof(UIAtlas)) as UIAtlas;
         manualHeight = (int)(Screen.height * 2);
      } else {
         atlasRef.replacement = Resources.Load ("TestAtlas1x", typeof(UIAtlas)) as UIAtlas;
         manualHeight = (int)(Screen.height * 4);
      }

      UIRoot root = this.gameObject.GetComponent<UIRoot> ();
      if (root.scalingStyle != UIRoot.Scaling.FixedSize) {
         root.scalingStyle = UIRoot.Scaling.FixedSize;
      }

      if (root.manualHeight != manualHeight) {
         root.manualHeight = manualHeight;
      }

   }



Any help appreciated. Thanks

Pages: [1]