Scene is unreachable due to lack of entry points
Solution 1
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.
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.
Darkstar
Updated on July 21, 2022Comments
-
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?
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 over 8 yearsYou should award one of the answers - Sumit's helped me.
-
-
spongessuck almost 9 yearsIt looks like there's no segue to your GameOver scene, so there's no way for your initial view controller to present it.
-
Darkstar almost 9 yearsOk 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 almost 9 yearsAs 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 almost 9 yearsOk thanks so much for the help I'll let you know if it works.
-
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 almost 9 yearsself.view?.presentScene(gameOver, transition: transition)
-
Darkstar almost 9 yearsCan this be anything I want?
-
Sumit Oberoi almost 9 yearsyes particularly you set the storyboard ID to be used when you are pushing/presenting code without segue
-
yesthisisjoe over 7 yearsThis only worked for me after I cleared Derived Data and restarted XCode.