How does work touchBegin on SKSpriteNode(SKNode) on SpriteKit?

95 Views Asked by At

I use SpriteKit with Swift. A button I realized by override touchesBegin on SKSpriteNode. But I don't understand how it catch touch. Sometimes button not catch if over it has SKSpriteNode and sometimes on the contrary. Please explain to me.

Thanks!

1

There are 1 best solutions below

0
On

I assume that the issue you are having is touches not getting registered because of the .userInteractionEnabled setting. Make sure you do sprite.userInteractionEnabled = true because it defaults to false.