繁体   English   中英

迅速无法从GameViewController呈现我的第二个场景

[英]swift-can't present my second scene from GameViewController

我有两个场景,GameScene和PlayScene。 我可以展示我的GameScene,但是我不能展示PlayScene,我使用的是相同的代码和正确的文件名。我使用的是UIButton调用此函数。 我什至尝试不调用showGameScene而是仅调用goToPlayScene仍然无法正常工作。我正在使用GameViewController呈现这两个场景。

func showGameScene()
{
    if let scene = GameScene(fileNamed:"GameScene") {
        // Configure the view.
        let skView = self.view as! SKView
        /* Sprite Kit applies additional optimizations to improve rendering performance */
        skView.ignoresSiblingOrder = true
        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .AspectFill

        skView.presentScene(scene)
    }
}
func goToPlayScene()
{
    playButton.hidden = true
    Leaderboard.hidden = true

    if let scene = PlayScene(fileNamed:"PlayScene")
    {
        let skView = self.view as! SKView
        /* Sprite Kit applies additional optimizations to improve rendering performance */
        skView.ignoresSiblingOrder = true
        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .AspectFill

        skView.presentScene(scene)
    }

}

您是否创建了文件PlayScene.sks?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM