Custom SKSpriteNode not detected during touch

前端 未结 5 803
一整个雨季
一整个雨季 2020-12-15 09:06

In learning SpriteKit, I am trying to make a small adventure game. I am creating a hero, and adding it to the scene, and then later, during touchesBegan:, I det

5条回答
  •  醉酒成梦
    2020-12-15 09:56

    Just be sure to add this in your init method.

    self.userInteractionEnabled = YES;
    

    For some reasons this is not enabled by default when you subclass. At least for me it worked only when manually enabled.

提交回复
热议问题