Author Topic: Ngui Button collider problem  (Read 23939 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Ngui Button collider problem
« Reply #15 on: July 14, 2015, 11:59:13 PM »
Free version of NGUI hasn't been supported in a long time, there's not much I can do with it.

DJVDJV

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Ngui Button collider problem
« Reply #16 on: July 16, 2015, 01:05:20 PM »
I think it is not because of free version. I have most recent NGUI and most recent Unity.

SoullessDreamer

  • Newbie
  • *
  • Thank You
  • -Given: 8
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Ngui Button collider problem
« Reply #17 on: August 29, 2015, 04:59:09 AM »
I have had the same issue as well. However I have figured out why this is happening. When you lower the resolution on the standalone of the game. Lower than the resolution your PC is set at, the colliders of the buttons are thrown off. More so on the buttons set on the right side of the screen than the left.

To fix this: If you set your monitor resolution to the resolution you are going to test the standalone game on before you start the game. Everything will work as intended. So, if your user needs to set their resolution on the standalone to a lower one than their native resolution. Then they will need to change their PC resolution through windows before launching the game.

This seems to have fixed the issue across multiple alpha testers we have testing our game. I am working on a 'work around' that doesn't involve the user changing the PC's resolution before going into game. If I achieve this I will post here with how I was able to fix it.

I hope this temporary fix helps others.

computernerd92708

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Ngui Button collider problem
« Reply #18 on: September 03, 2015, 05:03:37 AM »
This is the same issue I am having.  I posted a video of it on Youtube (in the thread I created).  Reproduced it in the simplest way possible.

I did what was suggested here (switch to highest possible resolution), and that fixed the colliders.  But... there is no way my Surface 3 can support my game at 1920x1280 :(

I cannot even test my game...

And there is no way I am going to require every player to use only the highest resolution possible on their machine.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Ngui Button collider problem
« Reply #19 on: September 06, 2015, 05:07:25 PM »
Have you tried simply forcing Unity to assume a specific resolution on startup?
  1. Screen.SetResolution(width, height, fullScreen);
I force Windward to run at 720p on mobile devices this way and I've never experienced any issues, but then again I am still using Unity 4.6.7 for it.

Matthew

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Ngui Button collider problem
« Reply #20 on: September 16, 2015, 06:45:16 PM »
Forcing users to a specific resolution is not a viable option for a commercial product. The free version was used to demonstrate the bug. But the bug occurs in the non-free version.

Is this a bug that you are not interested in fixing?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Ngui Button collider problem
« Reply #21 on: September 20, 2015, 02:08:42 AM »
Are you saying Windward is not a commercial product?

Mobile devices often have insane resolutions with very low power GPUs on tiny screens. Whether the game runs at 4k or 720p on a 5 inch screen is not something you can determine without a magnifying glass, and the 720p offers far better performance.

Anyway, all that aside, I was suggesting forcing the Screen.SetResolution to the desired resolution. Ie: if your game should be 1920x1080, set it to exactly that. Basically force Unity to use the resolution it should already be using. That's what I suggested.
  1. Debug.Log(Screen.width + "x" + Screen.height);
  2. Screen.SetResolution(Screen.width, Screen.height, true);
As for "fixing" it, the issue is in Unity, not in NGUI -- as evidenced by the fact that it used to work fine in previous versions of Unity. I can only suggest work-arounds for it.

P.S. It's a known Unity issue that also affects Unity's built-in UI exactly the same way: http://issuetracker.unity3d.com/issues/button-position-is-wrong-on-fullscreen-player-which-aspect-ratio-is-different-then-monitors
« Last Edit: September 20, 2015, 02:18:29 AM by ArenMook »