Created
November 6, 2017 16:01
-
-
Save hon454/97833950e08f26e3dc0ba341bd527e7a to your computer and use it in GitHub Desktop.
[SteamVR][Unity] Get tracked object serial number
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 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