I'm having leak problems using GKStateMachine. My application is pretty simple code to check the problem. This is GameScene:
import SpriteKit
import GameplayKit
class GameScene: SKScene {
lazy var gameState:GKStateMachine = GKStateMachine(states: [Introduction(scene: self)])
override func didMove(to view: SKView) {
self.gameState.enter(Introduction.self)
}
}
And this is my condition:
import SpriteKit
import GameplayKit
class Introduction: GKState {
unowned let scene:GameScene
init(scene:SKScene) {
self.scene = scene as! GameScene
super.init()
}
override func didEnter(from previousState: GKState?) {
print("INSIDE THE Introduction STATE")
}
}
The problem is that when I run the Leaks debugger, I got one leak as soon as I enter the state. Does anyone have a suggestion?
source
share