Unity Android NGUI Components shows smaller on the build version than the Emulator version

775 Views Asked by At

So i was building this UI for an app in Unity to be deployed on Android Platform.

Here is the preview from the Game Window :

enter image description here

But when i build and run the app on my device, it shows this :

enter image description here

The header log is anchored on Top, the title is anchored on Center and the buttons are anchored on Bottom.

Here is the hierarchy of the components :

enter image description here

Im new to Unity and NGUI so i really dont know what's wrong with this. Thank you guys.

2

There are 2 best solutions below

0
On BEST ANSWER

Different behavior is probably caused by different resolution/ration on your device in compare to your editor window. To emulate such behavior in the unity editor, you can force resolution/ration in your game window, or you can add your specific device resolution (what I actually recommend for you to do as a good start):

adding custom resolution

When you experiment with few of them, you will see that your interface is behaving in different ways.

To change that behavior on different screens, you can check your UIRoot options, especially Scaling, see UIRoot documentation.

Another good places to start is NGUI forum's topic concerned in handling different resolutions or official video about NGUI anchors.

Hope that this will guide you to perfect cross-device interface design.

0
On

I think your problem is configuring how is going to work NGUI with your sprites. There are 2 things you could do:

Use a pixel perfect resolution: This will maintain the perfect size of the sprite, and will look the same on every platform (this causes some things to look smaller if the resolution is higher)

Use a fixed Size of the UI and recalculate the sized based on the device. The problem you are having here.. is because of that. The background for example, should be larger if the screen is larger. To achieve that.. NGUI provides you with a UIRoot where you can configure the Scaling style to PixelPerfect, FixedSize and FixedSizeOnMobiles.

Try setting that up and the images will adapt to the different sizes.

Hope this works for you, I'll attach an image so you can check out what I'm talking about

enter image description here