Forum Discussion

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

Issues with auto-launching direct-to-rift Unity build

Hello,

I've created an application for the DK2 using Unity 4.5.2, and I need to be able to keep the application running (if it crashes, it needs to be supervised and brought back up automatically).

To do this, I've tried to use a couple of utilities, including ProcessAlive, Application Monitor and Restart On Crash, but I always get the same error when the utility attempts to launch the Direct-to-Rift version of the application: "Unable to run the Unity application binary: Is the patcher executable named correctly?"

The normal version of the build launches just fine using these utilities; it's just the direct-to-rift version. Also, the direct-to-rift version works when I launch it myself.

I'm running Windows 8 with the 0.4.2 Oculus SDK (going to wait until things settle down before updating to 0.4.3).

Can anyone shed some light on this issue? Tried looking around to see if anyone else had a similar issue, but couldn't find anything precisely relevant to this situation.

Thanks.

5 Replies

Replies have been turned off for this discussion
  • Check the current working directory. It needs to be the same folder that contains the binary.
  • Thanks for the response.

    All I've done is copy the build folder (see the attached screenshot) to the desktop on the Windows machine (I'm actually developing on a Mac). I'm not entirely sure what it requires, as the data folder is there in the same directory as the DTR exe.

    Sorry if you have to spell it out to me, I'm pretty new to this...
  • If you are launching _DirectToRift.exe from a script, be sure to call Directory.SetCurrentDirectory(dirContainingExe) first. In _DirectToRift.exe, we use the "current directory" to locate the _Data folder and the original executable.
  • Thanks.

    I managed to scrounge up a Visual Basic script that successfully reopens an application if it's not already open, and paired it up with the Task Scheduler so it runs the script every 5 minutes.

    However, since I have no experience with Visual Basic, I'm not sure how to integrate the setCurrentDirectory line into this. I sat down for a few hours and tried to work it out with a lot of research, but kept getting errors that I couldn't resolve. Probably just need more time to learn the syntax.

    I'm not expecting the answer to just be handed to me since it would be good to learn this, but it would be great if you could give a little more guidance about how to go about it - I appreciate it.

    This is the .vbs script I'm using:

    blnRunningProgramFound = False 

    For Each process In GetObject("winmgmts:").InstancesOf _
    ("win32_process")
    If process.Name = "SIMS_Development_Windows_2.7b_DirectToRift.exe" Then
    ' Program found
    blnRunningProgramFound = True
    End If
    Next

    If blnRunningProgramFound = False Then
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "C:\Users\Michael\Desktop\SIMSOculus\SIMS_Development_Windows_2.7b_DirectToRift.exe"
    End If
  • I don't know VBS, but you probably need to add the following before calling WshShell.Run:
    WshShell.CurrentDirectory = "C:\Users\Michael\Desktop\SIMSOculus\"