readyplayerme / rpm-unity-sdk-avatar-creator

Avatar Creator helps you create an avatar in Unity.
MIT License
30 stars 6 forks source link

The 0.4.0 sample causes a runtime error on android devices. #33

Closed fantastxu closed 1 year ago

fantastxu commented 1 year ago

Describe the bug The 0.4.0 sample causes a runtime error on android devices.

I can create avatars in Unity Editor without problem. On android devices, I got runtime errors as follows:

image

rYuuk commented 1 year ago

I tested it on my Android device and it appears to be functioning properly. May I ask which version you are currently using?

fantastxu commented 1 year ago

I made a new clean Unity project and tested it again, but got the same error. Unity version: 2021.3.24f1 Installed package: image Compiled for Android APK.

I also attached the APK, the Unity log, and the Unity project here. It will be great if you can look at it. Thanks in advance.

log.txt RPM_Creator_Test.zip RPMCreator.apk.zip

rYuuk commented 1 year ago

This error was also occurring on webgl, it was related to serialization of array in netwonsoft json. I fixed it(https://github.com/readyplayerme/rpm-unity-sdk-avatar-creator/pull/34) on develop branch, will it be possible for you to try develop branch?

fantastxu commented 1 year ago

Got another different deserialized error image

image

fantastxu commented 1 year ago

Okay, I figured out how to fix the runtime error above. In Unity, when you compile the project with the IL2CPP backend on, the 'byte code' stripping function is also always on, you can't turn it off. It makes some classes in the 'JsonHelpers' folder stripped from the build.

You can prevent it by adding a 'link.xml' file to the project.

Below are my addings in the file:

`

`

However, the APK with the added linker still gets stuck at the 'pick an avatar' step. This time I believe that the RPM server throws an error.

image

rYuuk commented 1 year ago

Thanks for investigating, we will look into it. It would be great if you could also provide the log file for the above mentioned error.

fantastxu commented 1 year ago

I have located the code that causes the issue. In AOT(il2cpp) backend, the NewtonJson plugin seems not doing well on the 'struct' deserialization. I forked the current 'develop' branch to my space and made the fix. You can check my changes if you want or maybe I can make a pull request of it?

rYuuk commented 1 year ago

Please go ahead and make a PR.