Skip to content

Instantly share code, notes, and snippets.

@hon454
Created November 6, 2017 16:01
Show Gist options
  • Save hon454/97833950e08f26e3dc0ba341bd527e7a to your computer and use it in GitHub Desktop.
Save hon454/97833950e08f26e3dc0ba341bd527e7a to your computer and use it in GitHub Desktop.
[SteamVR][Unity] Get tracked object serial number
using UnityEngine;
using Valve.VR;
public class SteamVR_GetTrackedObjectSerialNumber : MonoBehaviour
{
private void Start()
{
uint index = 0;
ETrackedPropertyError error = new ETrackedPropertyError();
for (uint i = 0; i < 16; i++)
{
var result = new System.Text.StringBuilder((int)64);
OpenVR.System.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_SerialNumber_String, result, 64, ref error);
Debug.Log(result);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment