Not sure if it is the same in objective C, but in swift I had to "override" a callback function that SKView calls behind the scenes,
func CBApplicationDidBecomeActive()
{
}
This function was causing paused to be reset.
(note override keyword should not be applied)
In some cases where you want to just retain the state of pause, make a new variable instead and override the isPaused method.
class GameScene:SKScene
{
var realPaused = false
{
didSet
{
isPaused = realPaused
}
}
override var isPaused : Bool
{
get
{
return realPaused
}
set
{
//we do not want to use newValue because it is being set without our knowledge
paused = realPaused
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…