Scene is unreachable due to lack of entry points

16,929

Solution 1

enter image description here

Set a text for your storyboard ID

Solution 2

You need to set one of your ViewControllers as the initial view controller for your storyboard.

init view controller option

EDIT

You need a segue to your GameOver scene. Right now there's no way for your initial view controller to present it.

Solution 3

Error reason is the presence of the same viewController identifier! You need to give different viewController above storyBoard different identifier. enter image description here

Share:
16,929
Darkstar
Author by

Darkstar

Updated on July 21, 2022

Comments

  • Darkstar
    Darkstar almost 2 years

    I've got a game where if you hit an enemy, you go to the gameover screen. I added a view controller to main.storyboard and made the class GameOver. However, it says I need an entry point and when I load the app it is just a blank screen. The thing is, I dont really need an entry point because I am switching scenes in the code when an enemy collides with the player. No button "entry point" needed. How can this be fixed?

    enter image description here

    enter image description here

    Here is the code for collision with enemy:

    func CollisionWithEnemy(Enemy: SKShapeNode, Player: SKSpriteNode) {
    
        //Highscore
        var ScoreDefault = NSUserDefaults.standardUserDefaults()
        ScoreDefault.setValue(Score, forKey: "Score")
        ScoreDefault.synchronize()
    
    
        if (Score > Highscore) {
            var HighscoreDefault = NSUserDefaults.standardUserDefaults()
            HighscoreDefault.setValue(Score, forKey: "Highscore")
        }
    
        var gameOver:SKScene = GameOver(size: self.size)
        ScoreLabel.removeFromSuperview()
        Enemy.removeFromParent()
        Player.removeFromParent()
        self.view?.presentScene(gameOver, transition: transition)
    
    
    }
    
    • David H
      David H over 8 years
      You should award one of the answers - Sumit's helped me.
  • spongessuck
    spongessuck almost 9 years
    It looks like there's no segue to your GameOver scene, so there's no way for your initial view controller to present it.
  • Darkstar
    Darkstar almost 9 years
    Ok so I don't need a segue if I'm just switching scenes through code? Because it worked fine switching to the gameover scene when I was doing it through code. I'll add a segue once I get home.
  • spongessuck
    spongessuck almost 9 years
    As you saw, Xcode will yell at you if you don't have a segue, even though your program works the way you want. You could move GameOver to it's own nib if you want to present it yourself and not have the storyboard manage it.
  • Darkstar
    Darkstar almost 9 years
    Ok thanks so much for the help I'll let you know if it works.
  • Will M.
    Will M. almost 9 years
    @Darkstar How are you switching scenes through code? The error also says that your view controller does not have a storyboard identifier with which to create it in code.
  • Darkstar
    Darkstar almost 9 years
    self.view?.presentScene(gameOver, transition: transition)
  • Darkstar
    Darkstar almost 9 years
    Can this be anything I want?
  • Sumit Oberoi
    Sumit Oberoi almost 9 years
    yes particularly you set the storyboard ID to be used when you are pushing/presenting code without segue
  • yesthisisjoe
    yesthisisjoe over 7 years
    This only worked for me after I cleared Derived Data and restarted XCode.