I have SCNScene subclass with a camera setup, that I want to use in all the subclasses.
let scene01 = TheSubclassScene()
let scene02 = TheSubclassScene(named:"art.scnassets/testScene.scn")!
self.sceneArray.addObject(scene01)
self.sceneArray.addObject(scene02)
I want to change the scenes at runtime. This works when I create the scene in code but not with a scene from the SceneKit Editor. So scene01
is working but scene02
isn't. In the debugger I can see the two scenes in the array. One is of type SCNSceneSubclass but the other is of type SCNScene.
Is there any way to get this working?
Update: This is my scene subclass
class TheSubclassScene: SCNScene
{
let cameraNode = CameraNode()
override init()
{
super.init()
self.rootNode.addChildNode(self.cameraNode)
}
required init?(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
}
}