Converted OBJ to SCN and now the object won't load

    let pathToBalloon = Bundle.main.path(forResource: "./Balloon2", ofType: "scn")!
    let balloonAsset = MDLAsset(url: URL(fileURLWithPath: pathToBalloon))
    let balloonObject: MDLObject? = balloonAsset.object(at: 0)
    let balloon = SCNNode(mdlObject: balloonObject!) // Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Using an .obj file with a balloon works great and displays in SCNView just fine. To use extra features Xcode asked me to convert to a .scn format. The model loads just fine in the Xcode editor, however balloonAsset.object(at: 0) now returns nil.

I really wanted to smooth the geometry and other stuff so continuing to use .obj files is meh.

What could the issue be?

Answered by Oxygens in 737029022

Solved by switching to loading via SCNScene(url:).

Accepted Answer

Solved by switching to loading via SCNScene(url:).

Converted OBJ to SCN and now the object won't load
 
 
Q