Author Topic: UI cropped in Web Player  (Read 11033 times)

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
UI cropped in Web Player
« on: November 15, 2013, 09:16:00 AM »
Hi,
after upgrading NGUI from version 2.x to 3.x I have an issue on the Web Build of my game: the interface is cropped.

Maybe I misconfigured my UI Root, but I can't figure it out.
It's set to FixedSizeOnMobiles, Manual Height 600, Minimum Height 600, Maximum Height 1536.

Player is set to 960x600 resolution.

Here's what happens.

Ok inside Unity and on mobile devices: https://dl.dropboxusercontent.com/u/17965504/ok.jpg
Issue running in web player: https://dl.dropboxusercontent.com/u/17965504/not.jpg

Any idea?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #1 on: November 15, 2013, 09:55:32 AM »
Fixed size on mobiles means the fixed size (600) is only used on mobile devices. I am guessing you built your web player with a chosen resolution of more than 600 pixels tall.

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: UI cropped in Web Player
« Reply #2 on: November 15, 2013, 11:22:25 AM »
the player is set to 960x600.

at the beginning i also thought that the player had a height lower than the fixed size.

what do you suggest ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #3 on: November 15, 2013, 11:41:35 AM »
Your editor window seems to be set to "free aspect"...

You need to change it to be the same resolution you're building for.

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: UI cropped in Web Player
« Reply #4 on: November 17, 2013, 04:56:13 PM »
You are right, at target resolution in the editor I see that the camera doesn't see the whole interface.
https://dl.dropboxusercontent.com/u/17965504/camerafail.jpg

How can I fix it? May I change UI Camera settings someway ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #5 on: November 17, 2013, 08:05:07 PM »
You can increase its manual height. This will let you see more. But doing so will cost you pixel-perfection. I suggest you move things around so they are in the right place, and make use of anchors.

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: UI cropped in Web Player
« Reply #6 on: November 19, 2013, 12:54:52 PM »
Hi,
I rolled back to a version where everything was OK, but something very weird happens.

In the editor nothing is outside the camera view, and when I set the desired resolution (960x600) in the game window and I hit play everything is visible, no crop: https://dl.dropboxusercontent.com/u/17965504/wtf.jpg
I can change the resolution to any height and still everything is working ok, no crop.

BUT when I build for the web with the desired resolution, something happens!
The building process fucks up the camera someway and it becomes the one you can see in the previous post: https://dl.dropboxusercontent.com/u/17965504/camerafail.jpg
Therefore, the UI gets cropped. The modification is permanent, I had to roll back again.

Any idea of wtf is the building process doing?
 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #7 on: November 19, 2013, 08:31:55 PM »
If your game window becomes hidden for any reason, NGUI won't be able to determine its size anymore because Unity won't report it correctly (as Screen.width and Screen.height will tell you the dimensions of the scene view instead).

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: UI cropped in Web Player
« Reply #8 on: November 20, 2013, 05:46:24 AM »
If your game window becomes hidden for any reason, NGUI won't be able to determine its size anymore because Unity won't report it correctly (as Screen.width and Screen.height will tell you the dimensions of the scene view instead).

The game window is in the main window, so it should be visible all the time even during the build process. What can I do?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #9 on: November 20, 2013, 03:14:35 PM »
Is there a reason you don't just use "fixed size" instead of "fixed size on mobile" btw? Fixed size will make it consistent on both mobile and PC, and will force a specific screen height at all times.

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: UI cropped in Web Player
« Reply #10 on: November 21, 2013, 11:57:11 AM »
Hi, problem solved:
first of all you are right, no reason to stay on "fixed size on mobile".
I set the UIRoot on "fixed size" and also upgraded to Unity 4.3 (I was on 4.2.2) and to NGUI 3.0.5 (I was on 3.0.4).

This time the build process went well and the web build works as intended.

Thanks -as always- for your patience and your time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI cropped in Web Player
« Reply #11 on: November 21, 2013, 01:52:38 PM »
:)