0

for some reason, whenever i win the game, that is the player hits the target, the app crashes at line
playerPhysicsBody.node?.addChild(emitter!)
with an error fatal error: unexpectedly found nil while unwrapping an Optional value any help here please?

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

Before Execute Check Whether Is Null Or Not.

    if(playerPhysicsBody != nil){
          playerPhysicsBody.node?.addChild(emitter!)
    }