forked from Unity-Technologies/com.unity.netcode.gameobjects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackedObjectEditor.cs
More file actions
35 lines (31 loc) · 1.12 KB
/
Copy pathTrackedObjectEditor.cs
File metadata and controls
35 lines (31 loc) · 1.12 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
using MLAPI;
using MLAPI.LagCompensation;
namespace UnityEditor
{
[CustomEditor(typeof(TrackedObject), true)]
[CanEditMultipleObjects]
public class TrackedObjectEditor : Editor
{
private TrackedObject trackedObject;
private bool initialized;
private void Init()
{
if (initialized)
return;
trackedObject = (TrackedObject)target;
initialized = true;
}
public override void OnInspectorGUI()
{
Init();
base.OnInspectorGUI();
if(NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsServer)
{
EditorGUILayout.LabelField("Total points: ", trackedObject.TotalPoints.ToString(), EditorStyles.label);
EditorGUILayout.LabelField("Avg time between points: ", trackedObject.AvgTimeBetweenPointsMs.ToString() + " ms", EditorStyles.label);
EditorGUILayout.LabelField("Total history: ", trackedObject.TotalTimeHistory.ToString() + " seconds", EditorStyles.label);
}
Repaint();
}
}
}