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!
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!
Copyright © 2021 Jogjafile Inc.
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.