2

I try to learn SpriteKit with Xcode 12.4 and swift5. When I made the first project and tried to run the simulator, it showed me a screen like in the below image.

You can see that screen is not full-size. So, I've changed the size of the attribute inspector in GameScene.sks but nothing changed.

GameViewController code is like below, I didn't change anything... How can I make my GameScene fullscreen on a simulator of iPhone 11?

class GameViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        if let view = self.view as! SKView? {
            if let scene = SKScene(fileNamed: "GameScene") {
                scene.scaleMode = .aspectFill
                
                view.presentScene(scene)
            }
        }
    }
}

Scene is centered with black gap on left and right, device is in landscape

aheze
  • 24,434
  • 8
  • 68
  • 125
Harry Ho
  • 21
  • 1

0 Answers0