I'm trying to load a .dae file into SCNScene, using the following code:
let solutionScene = SCNScene(named: "art.scnassets/level1.dae")
print(solutionScene?.rootNode) // prints nil
solutionNode = solutionScene?.rootNode.childNode(withName: "level1", recursively: true)
I exported the .dae file from Blender as COLLADA with default settings, contains just a one simple object.
When i click on the .dae file in my art.scnassets folder in XCode, it opens without problem and i can see the geometry, camera etc.
I just can't get it loaded in the SCNScene. Is there anything i missed either on Blender side or Xcode/Swift side?
In case somebody runs into a similar newbie problem, the issue gets resolved by adding the .scnassets folder into "Copy Bundle Resources" under Build Phases of the project - cleaning the project might be required in some cases before you rebuild again. This solved my issue.
来源:https://stackoverflow.com/questions/46514800/xcode9-scenekit-dae-file-not-loading-into-scnscene-returns-nil