OVRBuild.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /************************************************************************************
  2. Copyright : Copyright 2017 Oculus VR, LLC. All Rights reserved.
  3. Licensed under the Oculus VR Rift SDK License Version 3.4.1 (the "License");
  4. you may not use the Oculus VR Rift SDK except in compliance with the License,
  5. which is provided at the time of installation or download, or which
  6. otherwise accompanies this software in either electronic or hard copy form.
  7. You may obtain a copy of the License at
  8. https://developer.oculus.com/licenses/sdk-3.4.1
  9. Unless required by applicable law or agreed to in writing, the Oculus VR SDK
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ************************************************************************************/
  15. using UnityEngine;
  16. using UnityEditor;
  17. /// <summary>
  18. /// Allows Oculus to build apps from the command line.
  19. /// </summary>
  20. partial class OculusBuildApp
  21. {
  22. static void SetPCTarget()
  23. {
  24. if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.StandaloneWindows)
  25. {
  26. EditorUserBuildSettings.SwitchActiveBuildTarget (BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows);
  27. }
  28. UnityEditorInternal.VR.VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Standalone, true);
  29. PlayerSettings.virtualRealitySupported = true;
  30. AssetDatabase.SaveAssets();
  31. }
  32. static void SetAndroidTarget()
  33. {
  34. EditorUserBuildSettings.androidBuildSubtarget = MobileTextureSubtarget.ASTC;
  35. EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
  36. if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
  37. {
  38. EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
  39. }
  40. UnityEditorInternal.VR.VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Standalone, true);
  41. PlayerSettings.virtualRealitySupported = true;
  42. AssetDatabase.SaveAssets();
  43. }
  44. }