Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

fatal error: unexpectedly found nil while unwrapping an Optional value

jarvjarv Posts: 210Registered Users @ @
Please help, I get the error: unexpectedly found nil while unwrapping an Optional value
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
        let ball:SKSpriteNode = SKScene(fileNamed: "Ball")!.childNodeWithName("ball")! as! SKSpriteNode
        ball.removeFromParent()
        self.addChild(ball)
        ball.position = cannon.position
    }

this is the line of code that errors:
let ball:SKSpriteNode = SKScene(fileNamed: "Ball")!.childNodeWithName("ball")! as! SKSpriteNode
Tagged:
This discussion has been closed.