Skip to content

Commit

Permalink
Merge pull request #17 from benotter/Bug-Fixes
Browse files Browse the repository at this point in the history
Hopefully lowered CPU user in while idling
  • Loading branch information
benotter authored Jul 30, 2017
2 parents 7d0d7c2 + 63c0260 commit deccd88
Show file tree
Hide file tree
Showing 5 changed files with 703 additions and 636 deletions.
3 changes: 3 additions & 0 deletions Assets/OVRLay/Scripts/OpenVR/OVR_Handler/OVR_Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ public bool StartupOpenVR()
bool result = !ErrorCheck(error);

if(result)
{
GetOpenVRExistingInterfaces();
onOpenVRChange.Invoke(true);
}
else
ShutDownOpenVR(); // GetOpenVRInterfaces();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ private void DigestEvent(VREvent_t pEvent)
EVREventType type = (EVREventType) pEvent.eventType;
switch(type)
{
case EVREventType.VREvent_QuitAcknowledged:
case EVREventType.VREvent_Quit:

onOpenVRChange(false);
break;

case EVREventType.VREvent_DashboardActivated:
Expand Down
11 changes: 11 additions & 0 deletions Assets/OVRLay/Scripts/Unity_SteamVR_Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ void Start()
{
// Will always do a check on start first, then use timer for polling
lastSteamVRPollTime = steamVRPollTime + 1f;
ovrHandler.onOpenVRChange += OnOpenVRChange;
}

void OnOpenVRChange(bool connected)
{
if(!connected)
{
onSteamVRDisconnect.Invoke();
ovrHandler.ShutDownOpenVR();
}

}

void Update()
Expand Down
Loading

0 comments on commit deccd88

Please sign in to comment.