ViveInputUtility-Unity icon indicating copy to clipboard operation
ViveInputUtility-Unity copied to clipboard

Switch targets between Vive and Oculus using scripts (not GUI)

Open bearaccount opened this issue 3 years ago • 2 comments

Goal is to switch the headset target programmatically (so it's compatible with build pipeline). Manual way is of course switch headset target in VIU (Edit -> Preferences -> VIU Settings).

Method we have tried:

  1. Try to load a VIUSettings file. Steps:
  • In VIU Settings -> Choose Wave
  • Copy newly created Assets/VIUSettings/Resources/VIUSettings.asset and rename "VIUSettingsWave.asset".
  • In VIU Settings -> Choose Occulus Use Load: "HTC.UnityPlugin.Vive.VIUSettings.LoadFromResource(path);" where path was "Assets/VIUSettings/Resources/VIUSettingsWave.asset" Open back VIU Settings (still set to Oculus) and did a build for Wave (broke).
  • Changes in file: m_activateOculusVRModule: 1 m_activateUnityNativeVRModule: 1 m_activateUnityXRModule: 1 m_activateWaveVRModule: 0
  1. Tried to set symbols directly using PlayerSettings.SetScriptingDefineSymbolsForGroup Swapping symbols in an Editor script which throws Unity Editor into a compile loop: << OCULUSVR_ANDROID_SUPPORT >> VIU_WAVEVR_SUPPORT

Results is no change in target.

We need this for the build pipeline to build for two different targets.

bearaccount avatar Mar 22 '21 17:03 bearaccount

Try using:

EditorUserBuildSettings.SwitchActiveBuildTargetAsync(group, target);

dariol avatar Mar 22 '21 18:03 dariol

@bearaccount Hi, did you manage to switch the target headset programmatically?

Goldfinchworks avatar Dec 27 '21 10:12 Goldfinchworks