-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathTrackedObjectEditor.cs
More file actions
36 lines (30 loc) · 1.11 KB
/
TrackedObjectEditor.cs
File metadata and controls
36 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using MLAPI;
using MLAPI.LagCompensation;
namespace UnityEditor
{
[CustomEditor(typeof(TrackedObject), true)]
[CanEditMultipleObjects]
public class TrackedObjectEditor : Editor
{
private TrackedObject m_TrackedObject;
private bool m_Initialized;
private void Init()
{
if (m_Initialized) return;
m_TrackedObject = (TrackedObject)target;
m_Initialized = true;
}
public override void OnInspectorGUI()
{
Init();
base.OnInspectorGUI();
if (!ReferenceEquals(NetworkManager.Singleton, null) && NetworkManager.Singleton.IsServer)
{
EditorGUILayout.LabelField("Total points: ", m_TrackedObject.TotalPoints.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("Avg time between points: ", m_TrackedObject.AvgTimeBetweenPointsMs + " ms", EditorStyles.label);
EditorGUILayout.LabelField("Total history: ", m_TrackedObject.TotalTimeHistory + " seconds", EditorStyles.label);
}
Repaint();
}
}
}