Dynamically load Collada files in SceneKit at runtime

Опубликовано: 18 Май 2026
на канале: Sergey Koznov (Unik Arts)
297
3

So we go with SceneKit.

Create a new Xcode project, choose the Game template. Choose for SceneKit as Game Technology.

First you’ll need to create a Collada file (.dae) with a 3D program, like Blender (free), Maya, etc … (In the git repository you can find a test file). You can drop this file in the art.scnassets directory and you are done … except I want to load this file at runtime, so it is not accessible at compile-time. That’s a totally different story, as Apple applies some magic to the scnassets directory to optimize the included Collada files.

So how can we fixed this? I looked at the build logs what exactly happens to the scnassets folder to figure out what kind of magic is happening. It seems Apple calls a script named copySceneKitAssets, this script calls eventually scntool to optimize the included .dae files.

Alright with this knowledge I extracted these two scripts out of their directory (/Applications/Xcode/Contents/Developer/usr/bin) and placed them somewhere on my system.

So every time my client creates a new 3D model that should be available for sale via IAP, he should do the following.

Create a product.scnassets folder
Run the script
./copySceneKitAssets product-1.scnassets/ -o product-1-optimized.scnassets
Zip the result
Put it on the server