Xcode 6 iOS 시뮬레이터에서 이상한 동작을 발견했습니다.iOS 시뮬레이터에서 낮은 FPS SpriteKit
내 GameScene에 메뉴가 표시 되더라도 Simulator FPS 영역은 약 20FPS로 매우 낮습니다.
이 문제가 발생할 수있는 알려진 문제가 있습니까? 또한 게임 자체를 시작하면 즉시 30FPS에서 19FPS로 떨어집니다. 시작시로드
다음내 코드 :
override func didMoveToView(view: SKView) {
var sud:NSUserDefaults = NSUserDefaults.standardUserDefaults()
if(sud.valueForKey("highscores") != nil){
highScores = sud.valueForKey("highscores") as [Int]
}else{
highScores = [0, 0]
sud.setValue(highScores, forKey: "highscores")
}
createColors()
createStartMenu()
}
func createColors(){
colorArray = [
ColorClass(name: "greenSea", color: greenSea),
ColorClass(name: "emerald", color: emerald),
ColorClass(name: "peterRiver", color:peterRiver),
ColorClass(name: "amethyst", color:amethyst),
ColorClass(name: "wetAsphalt", color:wetAsphalt),
ColorClass(name: "sunFlower", color:sunFlower),
ColorClass(name: "carrot", color:carrot),
ColorClass(name: "pumpkin", color:pumpkin),
ColorClass(name: "alizarin", color:alizarin),
ColorClass(name: "pomeGranate", color:pomeGranate),
ColorClass(name: "clouds", color:clouds),
ColorClass(name: "asbestos", color:asbestos)]
}
func setSceneBackground(){
var background = SKSpriteNode(color: myBackgroundcolor, size: CGSizeMake(self.frame.width, self.frame.height))
background.position = CGPointMake(self.frame.width/2, self.frame.height/2)
self.addChild(background)
}
func createStartMenu(){
self.removeAllChildren()
setSceneBackground()
reset()
var background = SKSpriteNode(color: myBackgroundcolor, size: CGSizeMake(self.frame.width/1.2, self.frame.height/1.5))
background.position = CGPointMake(self.frame.width/2, self.frame.height/2)
var buttonSize:CGSize = CGSizeMake(background.size.width - 20, background.size.height/4 - 15)
background.setScale(0)
var alizarin = UIColor(rgba: "#e74c3c")
playLevelsButton = SKSpriteNode(color: alizarin, size: buttonSize)
playLevelsButton.position.y = buttonSize.height + buttonSize.height/2 + 15
var fontSize = buttonSize.height/2
playLevelLabel = SKLabelNode()
playLevelLabel.fontSize = fontSize
playLevelLabel.text = "Easy"
playLevelLabel.name = "playLevelLabel"
playLevelLabel.fontName = myFont
playLevelLabel.zPosition = 1
playLevelLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center
playLevelsButton.addChild(playLevelLabel)
var carrot = UIColor(rgba: "#e67e22")
playMoreDifficultButton = SKSpriteNode(color: carrot, size: buttonSize)
playMoreDifficultButton.position.y = buttonSize.height/2 + 5
playMoreDifficultLabel = SKLabelNode()
playMoreDifficultLabel.text = "Difficult"
playMoreDifficultLabel.fontName = myFont
playMoreDifficultLabel.fontSize = fontSize
playMoreDifficultLabel.name = "playMoreDifficultLabel"
playMoreDifficultLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center
playMoreDifficultButton.addChild(playMoreDifficultLabel)
var sunFlower = UIColor(rgba: "#f1c40f")
howToPlayButton = SKSpriteNode(color: sunFlower, size: buttonSize)
howToPlayButton.position.y = -buttonSize.height/2 - 5
howToPlayLabel = SKLabelNode()
howToPlayLabel.text = "How To Play"
howToPlayLabel.fontSize = fontSize
howToPlayLabel.fontName = myFont
howToPlayLabel.name = "howToPlayLabel"
howToPlayLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center
howToPlayButton.addChild(howToPlayLabel)
var emerald = UIColor(rgba: "#2ecc71")
highScoreButton = SKSpriteNode(color: emerald, size: buttonSize)
highScoreButton.position.y = -buttonSize.height - buttonSize.height/2 - 15
highScoreLabel = SKLabelNode()
highScoreLabel.text = "Highscore"
highScoreLabel.fontSize = fontSize
highScoreLabel.fontName = myFont
highScoreLabel.name = "highScoreLabel"
highScoreLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center
highScoreButton.addChild(highScoreLabel)
//Names
playLevelsButton.name = "playLevels"
playMoreDifficultButton.name = "playMoreDifficult"
howToPlayButton.name = "howToPlay"
highScoreButton.name = "highScore"
background.addChild(playLevelsButton)
background.addChild(playMoreDifficultButton)
background.addChild(howToPlayButton)
background.addChild(highScoreButton)
self.addChild(background)
background.runAction(SKAction.scaleTo(1, duration: 0.3))
}
func reset(){
correctColors = []
tileArray = []
tempArray = []
amountCorrect = 0
tapped = 0
gameStarted = false
maxTime = nil
timeStamp = 0
tileFrameSize = nil
searchColor = nil
tileColors = []
}
XCode 9. FPS = 1이고 DEBUG> Open System Log를 열고 다음과 같은 메시지가 표시됩니다. "com.apple.CoreSimulator.SimDevice.B9A5D2AF-5251-4F7A-8D00-DAF75203390A [49490] (com .apple.videosubscriptionsd) : 서비스는 0 초 동안 만 실행되었으며, 다시 10 초 동안 respawn을 푸시합니다. " –