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.
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.