Monday, 21 January 2019

Swift 4.2 - Cocoapods: Adding and accessing scnassets in resource_bundles

Attempting to create a cocoapod that utilizes an .scnassets folder. The folder is imported into Resources without any problems with the children objects, but I can't find a way to load the .dae files into an SCNScene. From my understanding there may be a problem with how XCode converts .dae into .scn assets.

.podspec includes:

  s.resource_bundles = {
      'ARUtilsScenes' => ['ARUtils/Assets/ARScenes.scnassets']
   }

which properly loads the ARScenes.scnassets into Resources folder. I'm attempting to load a scene inside of my Pod (inside the pod and not a project that uses the pod, and have tried a variety of methods):

let arrowScene = SCNScene(named: "arrow.dae")

let arrowScene = SCNScene(named: "Resources/ARScenes.scnassets/arrow.dae")

let arrowScene = SCNScene(named: "arrow.dae", inDirectory: "Resources/ARScenes.scnassets", options: nil)

I've tried a variety of file/folder names, and am able to load images but I'm not able to get a .dae loaded as an SCNScene. Do I need to add .xib files to my resource_bundles, or is there some other way to ensure .scnassets folder properly compiles these .dae to .scn as well as make them available for loading into an SCNScene?



from Swift 4.2 - Cocoapods: Adding and accessing scnassets in resource_bundles

No comments:

Post a Comment