How to convert Class types?

53 views Asked by At

I'm trying to figure out how to convert class type so that I can go from my SKScene which is 'self' to my SCNScene which is GamePlay. And basically perform a scene normal scene transition.

enter image description here Code:

let scene = GamePlay(coder:NSCoder())
let transition = SKTransition.crossFadeWithDuration(1)
view?.presentScene(scene, transition: transition)
1

There are 1 answers

0
Oleg Gordiichuk On BEST ANSWER

Try to cast you're scene to SKScene.

 let scene = GamePlay(coder:NSCoder())
 let transition = SKTransition.crossFadeWithDuration(1)
 if let skScene = scene as? SKScene {
        view?.presentScene(skScene, transition: transition)
 }