Open ntanduc2288 opened 5 years ago
+1 to this.
We have several 3D assets that get loaded randomly when an augmented Image is detected, and having the whole app freeze for a couple of seconds when the new image is detected is a bad user experience.
I have a 3D file (.sfb, size 30Mb) in the Assets folder, once I load it to memory by using these codes
ModelRenderable.builder() .setSource(context, Uri.parse(productName)) .build() .thenAccept { productRenderable = it } .exceptionally { throwable -> throwable.message?.let { view.showMessage(it) } null }
-> The view is hanging for a couple seconds (lagging).I'd tried to put it in a background thread but I got this error "Must be called from the UI thread." -> it means we have to run that code on the main thread.
So how to prevent the lagging issue when loading 3D object to memory? Thank in advance!