Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work at all with Android or IOS #451

Closed
anupamdas2012 opened this issue Jun 14, 2019 · 9 comments
Closed

Does not work at all with Android or IOS #451

anupamdas2012 opened this issue Jun 14, 2019 · 9 comments

Comments

@anupamdas2012
Copy link

tested on both Android and Ios with unity 2019.1.4f1. Tried the web based and non web based (UWP) examples, nothing works on either devices. Assuming mobile devices is not supported currently?

@AdamMitchell-ms
Copy link
Contributor

When you say that nothing works, can you be more specific? UnityGLTF should work for iOS and Android. If it's broken in some way, then we should get it fixed.

@marcspraragen
Copy link

marcspraragen commented Jun 18, 2019

I'm also having trouble running on Android. I tried builds with one scene, all scenes, and my own scene. The apk runs but just displays a blank game screen (skybox and floor). No way to navigate between scenes.

Also, no console errors, just warnings:

Script attached to 'GLTF' in scene 'Assets/UnityGLTF/Examples/StreamTestScene.unity' is missing or no valid script is attached.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Assets/UnityGLTF/Examples/OrbitCameraController.cs(22,22): warning CS0109: The member `UnityGLTF.Examples.OrbitCameraController.camera' does not hide an inherited member. The new keyword is not required

Unity 2017.4.29f1, building for Android 4.4 minimum.
Samsung 8+ running Android 9
buildscreen

@antoninklopp
Copy link

The problem is that File.ReadAllBytes() is not working for Assets on my side from my side.
I get a FileNotFoundException on Android and Oculus

@jingwenhz
Copy link

jingwenhz commented Jun 19, 2019

I also see only the skybox and floor when building on Android. adb logcat output shows:

Unity : ArgumentOutOfRangeException: Length cannot be less than zero.
Unity : Parameter name: length
Unity : at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <1f0c1ef1ad524c38bbc5536809c46b48>:0
Unity : at UnityGLTF.Examples.WebServerComponent.Start () [0x00007] in /Users/.../UnityGLTF/UnityGLTF/Assets/UnityGLTF/Examples/WebServerComponent.cs:12

The line in question in WebServerComponent.cs is
var wwwPath = appPath.Substring(0, appPath.LastIndexOf("Assets")) + "www";

I have no problems running/importing models in the Unity editor. Do we need to take additional steps to properly run scenes on mobile?

Edit: I just tried building for Mac instead and observed the same issue, so it does not appear to be a problem with mobile.

@antoninklopp
Copy link

Hi,

After a few tries on Unity Android, I managed to compile an Apk and got the plugin to work.
You need to do a few things :

  • Use the stream file and persistent data path to load the data. To do so, move a glb file into your data folder on your android device.
  • Add the shaders to the compilation.

@marcspraragen
Copy link

Excellent! Thanks for reply.

@AdamMitchell-ms
Copy link
Contributor

Hey @antoninklopp,

Thanks for figuring it out and sharing. Could you please update the readme.md with instructions for Android?

@Cris21395
Copy link

Hi @antoninklopp,

Can you explain in more detail how to load glb files for android? For example, do you copy manually glb files on android using adb or these files are stored at StreamingAsset folder?

Thanks.

@haosizheng
Copy link

Hi,

After a few tries on Unity Android, I managed to compile an Apk and got the plugin to work. You need to do a few things :

  • Use the stream file and persistent data path to load the data. To do so, move a glb file into your data folder on your android device.
  • Add the shaders to the compilation.

So, is it means I can not load GLTF from web at runtime on IOS or Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants