Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
fjhammingCleVR's avatar
fjhammingCleVR
Honored Guest
11 years ago

Building with oculus plugin and command line options

Hi,

I have a test project built with oculus sdk 0.4.4 in unity 4.6.1. We need to be able to support both VR mode and non-VR mode so I developed a way to disable Oculus VR with settings. However there is a small problem. The regular application starts in windowed mode after lauching the DirectToRift.exe variant.

I can change the mode by holding shift or alt while booting the application, but i cannot alter the preferences with command line arguments. Even -adapter N does not work after setting the fullscreen option back to fullscreen (and then not running directtorift)

Any clue on why the command line arguments could be overridden or ignored?

Freek Jan

4 Replies

Replies have been turned off for this discussion
  • bilago's avatar
    bilago
    Honored Guest
    "fjhammingCleVR" wrote:
    Hi,

    I have a test project built with oculus sdk 0.4.4 in unity 4.6.1. We need to be able to support both VR mode and non-VR mode so I developed a way to disable Oculus VR with settings. However there is a small problem. The regular application starts in windowed mode after lauching the DirectToRift.exe variant.

    I can change the mode by holding shift or alt while booting the application, but i cannot alter the preferences with command line arguments. Even -adapter N does not work after setting the fullscreen option back to fullscreen (and then not running directtorift)

    Any clue on why the command line arguments could be overridden or ignored?

    Freek Jan


    I would suggest throwing some logic in the code of your game to detect if in Rift mode and then if it is, toggle fullscreen with this:

    http://docs.unity3d.com/ScriptReference/Screen-fullScreen.html

     
    if (!Screen.fullscreen)
    Screen.fullScreen = true;
  • Hello fjhammingCleVR.
    I have a similar task. I need to make unity app with two modes: VR and nonVR. First time my app starting in nonVR mode (OVRManager, OVRCameraRig disabled). The app starts in full screen mode and i don't know how force start or switch it in Windowed mode.
    Do you have any idea?
    Thanks.
  • Hi Bloodimir

    At the moment I do not have a better solution. I guess that Unity 4.6.2 does make things better as they have changed some driver related things so that that the use of the directToRift exe is no longer required.

    I have not tried that as according to some sources here on this forum there are still some stability issues with unity 4.6.2 and oculus sdk 0.4.4.
  • I've found that the [app_name]_DirectToRift.exe executables don't wait for the main game's process to finish. So, I am wondering if maybe the parameters are being passed correctly to the DirectToRift exe, but not the sub-exe which is the true game exe? You could potentially use the .NET system.diagnostics.process class and query for your process name, latch onto it, then pass arguments that way? I suppose that's a windows only solution, just an idea though.

    An alternative, which is kind of a hack, is to have a sub-exe that's called by your unity app like this:
    MyGame_DirectToRift.exe --> Game launches in VR --> Go to settings --> Turn VR off --> ModeSwitcher.exe launches and MyGame.exe is exited --> MyGame.exe -params is launched to disable VR?

    Again, just ideas, hope it works out for you. Let me know if you find a solution, I'm just learning unity myself and this is super interesting for me. If you need help with system.diagnostics.process I can also provide you with code.

    -
    Edit: forgot to mention the app closes in my hack example.