Author Topic: BUG on android  (Read 8350 times)

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
BUG on android
« on: January 10, 2013, 03:10:44 PM »
hi I'm having a problem when i run my app works everything great, if i hit home on the android device and then run again my app the touch doesn't works

to replicate this problem these are the steps:
1) create a new project
2) import last version of ngui
3) add the scene Example 7 - Scroll View (Panel) on Scenes in Build
4) on gameobject camera uncheck Allow Multi Touch
5) compile for android
6) when the application is running, hit home on android device
7) run again the app and the touch isn't working on the app


please if some one knows how to resolve this because i need to update my app on the store quickly
« Last Edit: January 10, 2013, 04:40:15 PM by Darkmax »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: BUG on android
« Reply #1 on: January 10, 2013, 05:33:11 PM »
It's a bug in Unity 4.0 that was just reported by Nicki earlier today. Fogbugz ID #513193. It needs to be fixed on Unity's side as it affects all touches.

Until it gets fixed, I suggest you use an earlier version of Unity.
« Last Edit: January 10, 2013, 05:34:49 PM by ArenMook »

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: BUG on android
« Reply #2 on: January 10, 2013, 05:37:03 PM »
I'm not using unity 4, i'm using unity 3.5.7 so what version is stable to roll back?
« Last Edit: January 10, 2013, 05:43:08 PM by Darkmax »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: BUG on android
« Reply #3 on: January 10, 2013, 05:43:03 PM »
ORLY... it got broken it there too? Interesting.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: BUG on android
« Reply #4 on: January 10, 2013, 05:46:46 PM »
how can i check the status of the bugs on unity, to know when is solved?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: BUG on android
« Reply #5 on: January 10, 2013, 05:50:52 PM »
It may have been there always - I haven't really noticed it before 4.0 though. It may have been introduced to 3.5.7 at the same time as Unity4.

The problem is that Input.fingerId increments (or increases) when you go to hibernation on android, so multiTouch in UICamera gets confused since it assumes that fingerId is 0 (as it should be). Quickfix is to enable multitouch. That may break other stuff in your UI though if it can't handle it. I'm looking to make a workaround tomorrow, then I'll post a code snippet here.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: BUG on android
« Reply #6 on: January 10, 2013, 05:59:55 PM »
i will appreciate it, because if i check multi-touch i break other things on my project, maybe with the Input.touchCount could be a workaround?
« Last Edit: January 10, 2013, 06:34:10 PM by Darkmax »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: BUG on android
« Reply #7 on: January 11, 2013, 07:28:58 AM »
This should fix it, but I need to test it on device. I should have it tested in a few hours, but for now you can try this out as well:

Insert this in UICamera.cs instead of the beginning of the ProcessTouches that's there already. You should be able to see where it fits in. :)
  1. public void ProcessTouches ()
  2.         {              
  3.                 int firstTouchID = int.MaxValue;
  4.                 for (int i = 0; i < Input.touchCount; i++)
  5.                 {
  6.                         firstTouchID = Mathf.Min(Input.GetTouch(i).fingerId, firstTouchID);
  7.                 }
  8.                
  9.                 for (int i = 0; i < Input.touchCount; ++i)
  10.                 {
  11.                         Touch input = Input.GetTouch(i);
  12.  
  13.                         if (allowMultiTouch || input.fingerId == firstTouchID)
  14.                         { (...)
  15.  

Edit: We just tested on device and it works.
« Last Edit: January 11, 2013, 08:12:35 AM by Nicki »

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: BUG on android
« Reply #8 on: January 11, 2013, 12:32:25 PM »
thx nicki for the fix, i will try this right a way

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: BUG on android
« Reply #9 on: January 12, 2013, 12:36:07 PM »
There is one side-effect to this fix though: If you touch with 1 finger, then another at the same time and then lift the first finger, NGUI will think the second finger is the same as the first one.

If you do drag and drop things, it may act a little weird doing that.