cancel
Showing results for 
Search instead for 
Did you mean: 

Need to load Unity projects twice before they build correctly

houskyd
Level 2

I'm working professionally on a released Oculus Quest VR app, and have encountered a very strange error. If you load our app into Unity, the first build is always corrupt - it launches in a window instead of fullscreen and sometimes crashes. However, if you quit Unity and reload the project, the second build always succeeds and loads in fullscreen, running smoothly. The source of this problem is the Library folder. If you delete that folder, the first build after always fails, and reloading fixes the issue. I've diff'd the Library folder between loads, and the only significant difference is that ProjectSettings.asset appears in the second (working) library.

I've also diff'd the APKs and there is an obvious problem in the failing APK's AndroidManifest.xml (no other diffs). It is missing some very important lines that the working APK has. I've included all the lines that are different below, but the last 3 lines are the most important:

android:label="@String/app_name" is missing in failing build
android:configChanges in failing build includes: smallestScreenSize|touchscreen|mcc|mcn
<category android:name="com.oculus.intent.category.VR"/> - missing in failing build
<meta-data android:name="com.oculus.vr.focusaware" android:value="false"/> - missing in failing build
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/> - missing in failing build

The last line especially combined with the android:configChanges line would likely cause the windowed issue I'm seeing. However, I have no idea why the AndroidManifest.xml is being built differently. The ProjectSettings.asset file (outside of Library) for our project clearly states to load the app as a VR app, so I'm not sure why the first build wouldn't include the lines above. I noticed that there is an AndroidManifest.xml in Plugins/Android so I modified it to have the appropriate values above, but no matter what android:configChanges gets the smallestScreenSize|touchscreen|mcc|mcn values (even if I deleted them prior to building).

Another, possibly related, error that pops up is on the first load Unity complains about recursive serialization:
"Recursive Serialization is not supported. You can't dereference a PPtr while loading."
This error disappears if you just load Unity a 2nd time, so it's hard to believe it's a real error. The place it points to in the code does not have any recursive serialization. I'm not trying to solve this error, just providing it in case it helps with solving the first problem.

Does anyone have ideas on what's going wrong here? We could definitely use insight from the Unity team as this seems like an internal Unity issue.

We are using Unity 2018.4.v32f1, although this happens on 2018.4.v10f1 and 2018.4.v31f1 as well. I am testing moving to Unity 2019 but that is a larger effort and I'd like to figure this out before if possible.

0 REPLIES 0