Author Topic: Suggestion: Track clicked object for OnDoubleClick  (Read 3040 times)

ComicSans

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 6
    • View Profile
Suggestion: Track clicked object for OnDoubleClick
« on: February 10, 2014, 07:19:08 PM »
OnDoubleClick is currently only a function of elapsed time.  If you click on different objects fast enough, the second one receives OnDoubleClick.  While I could imagine that might be useful for some, I recommend the following change:

1) Add a "GameObject clicked" to MouseOrTouch.
2) Set currentTouch.clicked to currentTouch.pressed whenever clickTime is updated.
3) Only trigger OnDoubleClick if (currentTouch.pressed == currentTouch.clicked).

These changes helped me a lot, but since I hate maintaining differences from NGUI mainline, I'm throwing this out there as a suggestion.   :)

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Suggestion: Track clicked object for OnDoubleClick
« Reply #1 on: February 11, 2014, 08:39:32 PM »
Fair suggestion, but I would rather not keep any references to objects after the NGUI's update ends, so there is no easy way of checking "is this the same clicked object?".

Reason being, if you click on a "Load next level" button, and happen to store a reference to something, resources may not get unloaded properly.