Skip to content

Instantly share code, notes, and snippets.

@jeffcrouse
Created September 6, 2019 13:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeffcrouse/6419e84d7060c08c17cf97b9c41ddd14 to your computer and use it in GitHub Desktop.
Save jeffcrouse/6419e84d7060c08c17cf97b9c41ddd14 to your computer and use it in GitHub Desktop.
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