I am having the same problem now. I am following the advice but GameViewController is not able to see variables in the GameScene.
class GameScene: SKScene, SKPhysicsContactDelegate, GameSceneDelegate { weak var gameViewController: GameViewController? @State var selectedMusic: String?
override func viewDidLoad() {
super.viewDidLoad()
if let view = self.view as! SKView? {
if let scene = SKScene(fileNamed: "GameScene") {
scene.gameViewController = self
scene.scaleMode = .aspectFill
view.presentScene(scene)
}
view.ignoresSiblingOrder = true
}
}
Value of type 'SKScene' has no member 'gameViewController'
What is the fix for this?