I am using SpriteKit making a game , but before it went all right , but recently after I make it more compliant , something wrong just comes up. I have a button on the left corner , and while I touch the button , It showed nothing , so after I print out the information while touch the screen , I just find that it returns nil of this area , not even return the background information , the texture is nil , but if I touch other area , all go fine ,the information is all fine . So what is wrong here , I don't understand.
Here are some code that I write in toucheBegan function
let touchLocation = (touches as NSSet).anyObject()?.locationInNode(self)
let targetNode = self.nodeAtPoint(touchLocation!)
print(targetNode)
And the console return these : name:'(null)' texture:['nil'] position:{0, 0} scale:{1.00, 1.00} size:{1136, 640} anchor:{0.5, 0.5} rotation:0.00
It only happens on this button , I don't know why
The code that declare the button:
goRightButton = SKSpriteNode(imageNamed: "GorightButton1")
goRightButton.anchorPoint = CGPoint(x: 1, y: 0)
goRightButton.position = CGPoint(x: self.size.width - 200, y: 0)
goRightButton.name = "Right"
goRightButton.zPosition = -8
self.addChild(goRightButton)
if I run it on iPhone 6 , No buttons work at all! what happened ? if I run at iPod with IOS9 , It works fine .