Open victorluccassvl opened 4 years ago
I am also looking for a solution for that. I struggled several days of searching on the net and using trial&error... No working result so far.
You probably figured it out already but I am doing something like this to detect if a controller was connect/disconnected.
public void Enable()
{
if (steamVRControllerPose)
{
steamVRControllerPose.onConnectedChanged.AddListener(OnControllerConnected);
}
}
public void Disable()
{
if (steamVRControllerPose)
{
steamVRControllerPose.onConnectedChanged.AddListener(OnControllerConnected);
}
}
private void OnControllerConnected(SteamVR_Behaviour_Pose behaviour_Pose, SteamVR_Input_Sources changedSource, bool connected)
{
if (behaviour_Pose == steamVRControllerPose)
{
isControllerConnected = connected;
}
if (isControllerConnected)
{
SetVisibility(false, true);
}
else
{
SetVisibility(false, false);
}
GameLog.Log("Tracked device connection changed " + behaviour_Pose + " -- " + changedSource + " connected " + connected, GameLog.LogType.Info);
}
Hello! I would like to know if is there a way to allow my Unity application to use VR only if it is available, but not crash nor show any errors/warnings if it is not. I want it to be able to freely switch my VR gear on/off on playtime, track this change, and allow my app to know when to use a keyboard/mouse or joystic mode. Is that possible? I couldn't find easy ways of doing so.