Created
September 6, 2019 13:52
-
-
Save jeffcrouse/6419e84d7060c08c17cf97b9c41ddd14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using System.Text; | |
using UnityEngine; | |
using Valve.VR; | |
public class GameManager : MonoBehaviour | |
{ | |
[Range(10, 1000)] | |
public long LagMillis = 100; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
ListDevices(); | |
} | |
void ListDevices() | |
{ | |
for (int i = 0; i < SteamVR.connected.Length; ++i) | |
{ | |
ETrackedPropertyError error = new ETrackedPropertyError(); | |
StringBuilder sb = new StringBuilder(); | |
OpenVR.System.GetStringTrackedDeviceProperty((uint)i, ETrackedDeviceProperty.Prop_SerialNumber_String, sb, OpenVR.k_unMaxPropertyStringSize, ref error); | |
var SerialNumber = sb.ToString(); | |
OpenVR.System.GetStringTrackedDeviceProperty((uint)i, ETrackedDeviceProperty.Prop_ModelNumber_String, sb, OpenVR.k_unMaxPropertyStringSize, ref error); | |
var ModelNumber = sb.ToString(); | |
if(SerialNumber.Length > 0 || ModelNumber.Length > 0) | |
Debug.Log("Device " + i.ToString() + " = " + SerialNumber + " | " + ModelNumber); | |
} | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment