Skip to content

Commit

Permalink
fix: exception broke the loop of updating the sensor status
Browse files Browse the repository at this point in the history
  • Loading branch information
LeZi9916 committed Oct 27, 2024
1 parent 6840df6 commit 3c56a35
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions Assets/Script/DontDestroy/IO/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,18 @@ void StartInputDevicesListener()
{
while (!_cancelSource.IsCancellationRequested)
{
if (useDummy)
UpdateMousePosition();
else
UpdateSensorState();
UpdateButtonState();
try
{
if (useDummy)
UpdateMousePosition();
else
UpdateSensorState();
UpdateButtonState();
}
catch(Exception e)
{
Debug.LogException(e);
}
await UniTask.Yield(PlayerLoopTiming.FixedUpdate);
}
});
Expand Down Expand Up @@ -199,22 +206,28 @@ void StartExternalIOManager(bool useHID = false)
}
_ioManager.AddLedDevice(AdxLedDevice.GetDeviceName());

UniTask.Void(async () =>
}
catch (Exception e)
{
Debug.LogException(e);
}
UniTask.Void(async () =>
{
while (!_cancelSource.IsCancellationRequested)
{
while (!_cancelSource.IsCancellationRequested)
try
{
while (executionQueue.TryDequeue(out var eventAction))
eventAction();
UpdateSensorState();
await UniTask.Yield(PlayerLoopTiming.FixedUpdate);
}
});
}
catch (Exception e)
{
Debug.LogException(e);
}

catch(Exception e)
{
Debug.LogException(e);
}
await UniTask.Yield(PlayerLoopTiming.FixedUpdate);
}
});
}
void OnApplicationQuit()
{
Expand Down

0 comments on commit 3c56a35

Please sign in to comment.