prime31 / TouchKit

Gestures and input handling made sane for Unity
904 stars 137 forks source link

TouchKit.removeAllGestureRecognizers(); error #11

Closed inspire580i closed 10 years ago

inspire580i commented 10 years ago

if you execute this code

recognizer.onTouchUpInsideEvent += (r) => { TouchKit.removeAllGestureRecognizers(); };

you get an InvalidOperationException

on line 157 in TouchKit.

Please change:

this

foreach (var recognizer in _gestureRecognizers) { recognizer.recognizeTouches(_liveTouches); }

to this

foreach (var recognizer in _gestureRecognizers) { recognizer.recognizeTouches(_liveTouches); if (_gestureRecognizers.Count == 0) break; }

prime31 commented 10 years ago

That solution would work but I think it might be better to just do a for loop instead of a foreach. I'll stick that in the next push.