Open Pavel-Mishin opened 6 years ago
To get the asset loading in three.js you need a localUri
. You can get this with Expo.Asset.fromModule().localUri
. I'm not 100% sure how assets work with bundling in stand alone.
I have some assets bundled in my game Pillar Valley that uses the newest expo-three / expo (SDK 28 as of writing this). It works there. Here is the source: https://github.com/EvanBacon/Expo-Pillar-Valley/blob/8804dd192f2e4affd5836ccfa6437cf0f013668c/client/Game/Game.js#L167-L169
@EvanBacon Thanks! I'll try to have deal with Expo.Asset.fromModule().localUri, and to research code of your project.
@EvanBacon Well, i tried to use approach from Pillar Valley - with caching images as files through expo-asset-utils (but i don't understand why do we need to cache bundled images) and creating textures through ExpoTHREE.loadAsync, but it didn't resolve the issue. Then I check Pillal Valley standalone build and... it have the same issue! Steps to Reproduce:
P.S. Also, I tried to install Pillar Valley from Google Play on few devices, and there is the same problem with textures.
Hi @EvanBacon, I'm wondering if this issue can be addressed as it prevents expo-three from loading texture when building an Android APK. Please see this expo-three issue: https://github.com/expo/expo-three/issues/225
Steps to Reproduce:
to app.json.
And on this step local project worked properly, but in app installed from builded apk there is no background image, just black (with 2.. expo-three versions) or white (with 3.0.0-alpha.2) screen. There is bg.png in extracted by apktool folder, and i can use it for example for RN Image like this
<Image source={Asset.fromModule(Files.sprites.bg)} style={{width: '100%', height: '100%'}}/>
, and it appears properly in standalone app. I tried to remove Asset.fromModule().downloadAsync() since we have bundled file, i tried to create texture by Three.Texture constructor and THREE.TextureLoader().load passing to them, Expo.Asset, require(), or just string with path, and i tried to use different paths like "assets/sprites/bg.png", "./assets/sprites/bg.png", "/assets/sprites/bg.png", and so on. There is another game I develop, it use different than flappy asset system, and also tried different variants to get assets and create textures, but it have exactly the same issue. I tested it on Android 5.0 device.