Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpriteKit SKScene missing touchesEnded

I've noticed that touchesEnded don't always get delivered to an SKScene on multi touch. Depending on speed of removing fingers etc, I would permanently miss some of the touchesEnded. touchesCancelled is implemented and I added a custom UIView and put over the left side of the screen - no problems. I made a custom SKView and captured events - again no problem.

It's obvious that SKScene doesn't get all the touchesEnded the SKView it's embedded in, but why?

(BTW, I'm running the SKScene completely without any nodes)

EDIT:

Some further investigation reveals I can get SKScene to lose a touch entirely:

I put 3 fingers on the display then remove them one at a time until only one finger touches. I move the finger -> only the SKView receives the move events, the SKScene doesn't. Nor does it receive the touchesEnded.

After some experimentation I can say that it happens when a touchesBegan receives more then 1 touch in a call (e.g. you press two fingers "simultaneously"). These two touches then get entangled so only one of them sends events.

This appears to be a bug in SKScene. I'm testing on an iPhone 5. It would

like image 879
Nuoji Avatar asked Oct 30 '13 17:10

Nuoji


1 Answers

May be you are using some gestureRecognisers? They have property cancelsTouchesInView and it's default value is YES. Changing it to NO solved my problem.

like image 105
Florelit Avatar answered Sep 30 '22 18:09

Florelit