I have the following code (SceneKit in Swift targeting on iOS):
let scnView = self.view as SCNView
let scene = SCNScene()
let levelScene = SCNScene(named: "level")
scene.rootNode.addChildNode(levelScene.rootNode)
scnView.scene = scene
scnView.backgroundColor = UIColor.grayColor()
scnView.allowsCameraControl = true
scnView.showsStatistics = true
The problem is that when scene.rootNode.addChildNode(level.rootNode)I get the following error in the console:
[SCNKit ERROR] removing the root node of a scene from its scene is not allowed
I'm not sure why this error occurs, but I'm trying to upload my file level.daeand add it to the scene. From what I see in the simulator (and device), it loads fine.
What to do to prevent an error message?
source
share