Spelunx Cavern SDK
 
Loading...
Searching...
No Matches
BodyTrackerManagerInspector.cs
Go to the documentation of this file.
1using UnityEditor;
2using UnityEngine;
3using System.Collections.Generic;
4
5namespace Spelunx.Orbbec {
6 [CustomEditor(typeof(BodyTrackerManager))]
7 public class BodyTrackerManagerInspector : Editor {
8 public override void OnInspectorGUI() {
9 DrawDefaultInspector();
10
11 BodyTrackerManager bodyTrackerManager = (BodyTrackerManager)target;
12 List<string> foundSerials = bodyTrackerManager.GetAvailableSerials();
13
14 GUIStyle headerStyle = new GUIStyle(GUI.skin.label);
15 headerStyle.fontStyle = FontStyle.Bold; // Bold the header.
16 headerStyle.fontSize += 4; // Slightly increase the font size.
17 GUILayout.Space(8); // Leave some padding.
18 if (0 == foundSerials.Count) {
19 GUILayout.Label("No Devices Found (Enter Play Mode to scan for devices.)", headerStyle);
20 } else {
21 GUILayout.Label("Devices Found (Selecting also copies serial number to clipboard.)", headerStyle);
22 }
23
24 for (int i = 0; i < foundSerials.Count; ++i) {
25 if (GUILayout.Button("Select Device " + foundSerials[i])) {
26 EditorGUIUtility.systemCopyBuffer = foundSerials[i];
27 bodyTrackerManager.SetDeviceSerial(foundSerials[i]);
28 }
29 }
30 }
31 }
32}
Manager class to pass data from FrameDataProvider to BodyTracker.
void SetDeviceSerial(string deviceSerial)