Author Topic: Example 11 on Android  (Read 4749 times)

demid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Example 11 on Android
« on: July 14, 2012, 09:38:16 AM »
Hi!

I'm starting to learn recently purchased NGUI package. Currently I need to implement an inventory box behaviour very similar to Example 11. That one works perfectly in the built-in player but does not work properly on my HTC Incredible S: when you start dragging the sprite it's actually not moving. But the rest of the drag and drop process works - the item appears on the cube after releasing the finger. I'm using Unity basic - may this cause the bug?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example 11 on Android
« Reply #1 on: July 14, 2012, 09:57:15 AM »
It might be related to this: http://www.tasharen.com/forum/index.php?topic=624.msg5151#msg5151

Easiest thing to do will be to just test it in the next version and see if it fixes it. 2.1.0 should be out by tomorrow night at the latest. You can also make the change described in that thread locally and see for yourself before that.

demid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Example 11 on Android
« Reply #2 on: July 14, 2012, 12:03:11 PM »
The topic you are talking about concerns the double click and proper event raising (or I missed something?). In my case we are talking about behaviour of the item being dragged. Item is dragging to the correct place but you see only the final result - the sprite in inventory box is frozen and stands still until the user releases the finger over the 3D rotating box. After finger releasing the sprite disappears from the inventory box and a prefab is instantiated in the correct position.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example 11 on Android
« Reply #3 on: July 14, 2012, 01:32:55 PM »
It's about a lack of "Begin" event --an issue in Unity. I have a feeling the two may be related, since you're saying it only seems to be an issue on the android device.

demid

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Example 11 on Android
« Reply #4 on: July 14, 2012, 02:19:40 PM »
I found the problem - in the DragDropItem script line 75 inside OnDrag (Vector2 delta) we can see the following:
  1. if (UICamera.currentTouchID == -1)
I suggest using
  1. if (UICamera.currentTouchID == -1 || UICamera.currentTouchID >= 0)
This change fixed my bug.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example 11 on Android
« Reply #5 on: July 14, 2012, 02:22:15 PM »
Good point, although it can be simplified to
  1. if (UICamera.currentTouchID > -2)