How to load a local glb in babylon-native on iOS

I cant seem to get my babylon-native app on iOS to load local GLBs. What’s the secret?

I have my GLBs in <$project>/assets/resources/models/
I’ve added this dir to Copy Bundle Resources, and I see the build process take its time importing the GLBs by name so I know they’re bundled.

But then I try to load a model:

  const url = 'file://assets/resources/models/KCP1422.glb';
  SceneLoader.LoadAsync( url, undefined, engine).then((scene) => {

And the iPad throws the error:
“LoadFileError: Error status: 0 undefined - Unable to load file”

I’ve tried countless obvious variations on the URL, as well as importing the lower subdirs in the path down to the models dir itself. Different errors for different strategies, but never does it just work.

Ive searched for answers and found others with the same problem, but their solutions involved Firebase or ThreeJS or Expo.
The setup for the code is entirely babylon-react-native-sample otherwise, as a known good testbed.

The eventual app does need to load its resources locally and not from a remote server as it will sometimes be used offline.

I don’t have an answer for you as I struggled with this myself. Instead of .glb a viable workaround for us is using .babylon files renamed to .json and importing them directly into our typescript code. That way I don’t need to worry about packaging and loading local assets consistently and reliably in iOS and Android for both debug and release builds. This approach may not suit all use cases though.

cc @BabylonNative

@brechindo Can you try app:///assets/resources/models/KCP1422.glb?

The code that eventually loads the file is here:

If you can debug it, you might be able to find out more on why it doesn’t load the file.

Yep tried app: before, with both :// and :/// and it simply changes the error:

const url = 'app:///assets/resources/models/KCP1422.glb';
SceneLoader.LoadAsync( url, undefined, engine).then((scene) => {

Exception in HostFunction:
Error parsing URL scheme:
No file exists at local path

I havent even tried to get source-level debugging working yet. I barely know how to use XCode or this Mac at all.

If you can create a repro (maybe in a GitHub repo), then I can look at it and see if I spot something.