[英]how to access integer variable from GameScene to ViewController in swift
我有一個游戲中心按鈕,已從情節提要添加到我的GameViewController中。 我需要將在GameScene中創建的highscore變量用作排行榜上的highscore。
let highscore = self.gameScene.highscore
saveHighScore(number: highscore)
我的分數一直保持為零。 我該怎么辦?
我找到了解決方案。 我只需要使用
saveHighScore(number:highscoreDefault.value(forKey:“ highscore”)as!NSInteger!)
我的高分保存在手機存儲中的位置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.