Author Topic: Upgraded to 3.7.2 - Problem with UIButton  (Read 12171 times)

Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Upgraded to 3.7.2 - Problem with UIButton
« on: September 13, 2014, 09:50:20 AM »
As soon as I load a scene on Android, my buttons are showing (in a random way) like they are pressed or in hover state. .. Sometimes this happens, sometimes not.
This does not seem to happen on Editor, only when running on devices.. I've tested on Android only.

Any ideas on how to fix this? This was not happening in the previous version.

*EDIT: Tested on iOS and it happens too.

*EDIT 2: Added a ScreenShot .. The right button should be with the same aspect as the left one.
« Last Edit: September 13, 2014, 05:44:25 PM by fliperamma »

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #1 on: September 13, 2014, 04:59:45 PM »
Same problem here!

Really running out of ideas of what is happening!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #2 on: September 14, 2014, 03:30:10 AM »
Which version did you guys upgrade from? UIButton hasn't changed in over a month. How can I reproduce this on my end?

Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #3 on: September 14, 2014, 08:17:20 AM »
Hi Michael! Thank you for your reply.

Well, I don't know if the problem is really with UIButton, maybe it can be UICamera, which maybe have changed in the last update? (I haven't debugged it ... I'm experiencing problems with buttons only, which uses UIButton, UIButtonColor, UIButtonScale). My last version was 3.7.1

In my case, I have my usual interface (example: a Sidebar), and just by opening it I already start to see some buttons "hovered"... so I click "exit match" and this will show that confirmation screen (screenshot) and after that the game will load another scene.. in this new scene I have two buttons, "play" and "signup" and in a random way each one os those buttons are pressed / hovered too... all my interface is messed up.

It seems that I have a phantom finger messing around in my tablet  :o

I'll try to get more details


Thanks


Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #4 on: September 14, 2014, 09:12:29 AM »
Logs:

1) CloseButton (Button) (UIButtonScale) OnEnable Method - UICamera.IsHighlighted(gameObject) = False

2) CloseButton (Button) (UIButtonScale) Start Method (mStarted is true)

3) If nothing is pressed and there is an object under the touch, highlight it
 
4) CloseButton (Button) (UIButtonScale) OnHover (mStarted is true)  -  (isOver is true)

  1. //// Line 1392 of UICamera.cs
  2.  
  3. // If nothing is pressed and there is an object under the touch, highlight it
  4. if (!isPressed && highlightChanged)
  5. {
  6.         currentScheme = ControlScheme.Mouse;
  7.         mTooltipTime = RealTime.time + tooltipDelay;
  8.         mHover = mMouse[0].current;
  9.         currentTouch = mMouse[0];
  10.         if (onHover != null) onHover(mHover, true);
  11. //*****
  12.         Debug.Log("If nothing is pressed and there is an object under the touch, highlight it");
  13. //*****
  14.         Notify(mHover, "OnHover", true);
  15. }
  16. currentTouch = null;
  17.  


So, it seems that UICamera is the source of the problem. For some reason UICamera is firing a OnHover on my buttons...

I've made this test with a iOS / iPad mini.

Can you please fix this? This is actually an urgent situation for me.

Thanks

« Last Edit: September 14, 2014, 09:18:55 AM by fliperamma »

konsnos

  • Newbie
  • *
  • Thank You
  • -Given: 8
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #5 on: September 15, 2014, 02:33:02 AM »
@fliperamma
You can use 3.7.1 until this is fixed. There no need to get anxious.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #6 on: September 15, 2014, 04:27:43 AM »
Our lines don't match. Line 1392 is a comment for me.

I'm guessing I know what your issue is. You have mouse events enabled on your UICamera. Mouse events should be disabled for iOS.

Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #7 on: September 15, 2014, 10:20:05 AM »
Hi Aren! Thank you very much for your reply.
I have checked that already (before posting the message) and disabled it on all my cameras (leaving only the Touch event source) .... except one and that was the cause of my problems  :(

I saw that in UICamera's Awake method there's a "automatic" useTouch = true (which I was going to suggest as a improvement) but not a useMouse = false.
Is there a specific reason for this? Maybe a platform-specific problem?

  1. if (Application.platform == RuntimePlatform.Android ||
  2.         Application.platform == RuntimePlatform.IPhonePlayer
  3.         || Application.platform == RuntimePlatform.WP8Player
  4. #if UNITY_4_3
  5.         || Application.platform == RuntimePlatform.BB10Player
  6. #else
  7.         || Application.platform == RuntimePlatform.BlackBerryPlayer
  8. #endif
  9.         )
  10. {
  11.         useTouch = true;
  12. // It is possible to add a "useMouse = false" here?
  13.         if (Application.platform == RuntimePlatform.IPhonePlayer)
  14.         {
  15.                 useKeyboard = false;
  16.                 useController = false;
  17.         }
  18. }
  19.  

Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #8 on: September 15, 2014, 12:15:20 PM »
@fliperamma
You can use 3.7.1 until this is fixed. There no need to get anxious.

Hi! Actually yes, I have three different projects to upload this week.  :-\
But I do appreciate your suggestion and support!

I've made a quick fix here so I don't need to go, scene by scene in each project, checking if there's a UICamera with the wrong configuration. I have multiple programmers dealing with the 3 projects at the same time .. this will eventually lead to errors for sure. That's why I believe that this should be automatic where possible (above suggestion, useMouse = false)

If anyone is interested, here's a simple code for the quick fix (I'm new to NGUI so if there's a better solution, please let me know!):

  1. void Start()
  2. {
  3.         if(UICamera.mainCamera)
  4.         {
  5.                 UICamera uiCamera = UICamera.mainCamera.gameObject.GetComponent<UICamera>();
  6.                 if(uiCamera)
  7.                 {
  8.                         uiCamera.useTouch = true;
  9.                         uiCamera.useMouse = false;
  10.                         uiCamera.useKeyboard = false;
  11.                         uiCamera.useController = false;
  12.                         uiCamera.allowMultiTouch = false;
  13.                 }
  14.         }
  15. }
  16.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #9 on: September 16, 2014, 09:13:08 AM »
useMouse = false should be there, so that's an oversight. I've added it locally, so it'll be there in the next update.

Fliperamma

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 13
    • View Profile
    • Fliperamma | Game On!
Re: Upgraded to 3.7.2 - Problem with UIButton
« Reply #10 on: September 16, 2014, 02:53:07 PM »
useMouse = false should be there, so that's an oversight. I've added it locally, so it'll be there in the next update.
Hi!

Thanks for adding this to the next update! :)