Author Topic: NGUI Breaking on game window resize  (Read 7291 times)

vallcrist

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 49
    • View Profile
NGUI Breaking on game window resize
« on: March 09, 2014, 01:43:39 AM »
Hello again everyone. =)

I'm having a little problem with NGUI since 3.4~

It seems like the world-coordinates height of a dynamic label is calculated when it changes ( appears / changes text ).

Our game is a facebook game that uses the FacebookSDK, on the SDK, whenever we make a request to facebook, the game screen is "hidden", it goes really really small, after the request is completed, the game goes back to the previous resolution.

The problem is, if any label shows up in response to the request, and after the game goes back to normal resolution, she appears ridiculous large, i'll attach 2 screenshots showing it.

Intended : http://ctrlv.in/303516
Actual : http://ctrlv.in/303517

You can replicate it by:

Adding a dynamic label to a scene and deactivate it
Run the project
Set the game window to 10x10 using the resolution picker
Activate the label
Set the game window to 16:9 resolution

Any ideas how can I fix this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Breaking on game window resize
« Reply #1 on: March 09, 2014, 09:35:58 AM »
If you want to hide the UI, you can simply set the root UIPanel's alpha to 0, or better yet -- disable the camera that draws the UI.

vallcrist

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 49
    • View Profile
Re: NGUI Breaking on game window resize
« Reply #2 on: March 09, 2014, 12:14:21 PM »
The problem is not hiding the UI, it's the UI misbehaving on very small resolutions ( like the 10x10 that the facebook sdk sets the resolution when it's handling requests )

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Breaking on game window resize
« Reply #3 on: March 10, 2014, 08:48:19 PM »
Set UIRoot to use fixed size using the target resolution of your choice, and make sure your labels don't have the "keep crisp" option enabled, as it depends on the screen resolution.

vallcrist

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 49
    • View Profile
Re: NGUI Breaking on game window resize
« Reply #4 on: March 11, 2014, 10:11:19 AM »
Ok.. Keep crisp was the problem. Thanks aren