I want to present a SpriteKit scene from another SKScene in my WatchKit app. Here is my code:
class GameScene: SKScene, SKPhysicsContactDelegate {
var scene2: Scene2!
@IBOutlet var skInterface: WKInterfaceSKScene!
override func sceneDidLoad() {
physicsWorld.contactDelegate = self
....
changeScene()
}
func changeScene() {
if let scene = Scene2(fileNamed: "Scene2") {
scene2 = scene
scene.scaleMode = .aspectFill
self.skInterface.presentScene(scene)
self.skInterface.preferredFramesPerSecond = 30
}
} But when i try to present other scene i get this error:
"fatal error: unexpectedly found nil while unwrapping an Optional value"
How can i solve this problem?