- Home /
How do I enable VR in player settings on an android build target through C# on the command line?
// Set the Virtual Reality flag
PlayerSettings.virtualRealitySupported = true;
So, I've got the above line in a static method utilized by a build script. As part of the build I have to enable VR support on the android build target. The problem I'm running into is that the above code only enables VR support for the PC/Linux/Mac builds, and not the android build target, so the APK generated by the following code is not VR enabled.
BuildPipeline.BuildPlayer(new string[] { "baseScene.unity" }, apkPath, BuildTarget.Android, BuildOptions.None);
I've looked in the PlayerSettings.Android class, and there's no .virtualRealitySupported flag. It's only in the base PlayerSettings class, and doesn't seem to carry over to the Android buildTarget.
I cannot set the flag manually. It's an automated process that pulls source from git and builds a fresh project through the command line. No manual interaction is allowed.
How do I enable virtual reality support for an android build target in my build script?
I think I figured out how to switch build targets on command line with the -buildTarget argument. However, -buildTarget seems to be crashing unity if I issue it and the documentation on it doesn't say if it has any additional requirements or not.
I get the following (quite worthless) stack trace when I try to compile a new project form the command line with -buildTarget android:
Targeting platform: android
Assertion failed on expression: 'pos < this->m_num_bits'
(Filename: C:\buildslave\unity\build\Runtime/Utilities/dynamic_bitset.h Line: 612)
Crash!!!
SymInit: Symbol-SearchPath: '/$$anonymous$$onoEmbedRuntime;.;/BrandNewProj;
========== OUTPUTING STAC$$anonymous$$ TRACE ==================
0x00000001401939F0 (Unity) GetPrecompiledAssembly$$anonymous$$ask
0x00000001401AC47B (Unity) ForceRecompileAllScriptsAndDlls
0x0000000140FA4D63 (Unity) UnityConnectSettings::OnEditorBuildTargetChanged
0x000000014149A044 (Unity) EditorUserBuildSettings::SetActiveBuildTarget
0x0000000141483487 (Unity) Application::InitializeProject
0x0000000141548C87 (Unity) Win$$anonymous$$ain
0x0000000141863E94 (Unity) strnlen
0x00007FF9B2BD8364 ($$anonymous$$ERNEL32) BaseThreadInitThunk
0x00007FF9B2DA70D1 (ntdll) RtlUserThreadStart
========== END OF STAC$$anonymous$$TRACE ===========
Your answer
Follow this Question
Related Questions
Oculus Plugin causes crash in Jenkins when building APK 0 Answers
Can handheld.PlayfullScreenMovie() work with Vr view to play 360 degree video using google vr sdk? 0 Answers
Sending information from android game to android app via Bluetooth/Wifi-Direct 0 Answers
Android: Disable Autorotate Animation 0 Answers