Skip to content

Commit 678d0ba

Browse files
committed
feat: Added instanceId and prefabHash to inspector
1 parent 330b0b8 commit 678d0ba

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

MLAPI-Editor/NetworkedObjectEditor.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using MLAPI;
33
using UnityEngine;
44

@@ -23,8 +23,6 @@ private void Init()
2323
public override void OnInspectorGUI()
2424
{
2525
Init();
26-
if (NetworkingManager.Singleton == null || (!NetworkingManager.Singleton.IsServer && !NetworkingManager.Singleton.IsClient))
27-
base.OnInspectorGUI(); //Only run this if we are NOT running server. This is where the ServerOnly box is drawn
2826

2927
if (!networkedObject.IsSpawned && NetworkingManager.Singleton != null && NetworkingManager.Singleton.IsServer)
3028
{
@@ -58,21 +56,27 @@ public override void OnInspectorGUI()
5856
if (showObservers)
5957
{
6058
HashSet<ulong>.Enumerator observerClientIds = networkedObject.GetObservers();
61-
59+
6260
EditorGUI.indentLevel += 1;
63-
61+
6462
while (observerClientIds.MoveNext())
6563
{
6664
if (NetworkingManager.Singleton.ConnectedClients[observerClientIds.Current].PlayerObject != null)
6765
EditorGUILayout.ObjectField("ClientId: " + observerClientIds.Current, NetworkingManager.Singleton.ConnectedClients[observerClientIds.Current].PlayerObject, typeof(GameObject), false);
6866
else
6967
EditorGUILayout.TextField("ClientId: " + observerClientIds.Current, EditorStyles.label);
7068
}
71-
69+
7270
EditorGUI.indentLevel -= 1;
7371
}
7472
}
7573
}
74+
else
75+
{
76+
base.OnInspectorGUI();
77+
EditorGUILayout.LabelField("PrefabHash: ", networkedObject.PrefabHash.ToString(), EditorStyles.label);
78+
EditorGUILayout.LabelField("InstanceId: ", networkedObject.NetworkedInstanceId.ToString(), EditorStyles.label);
79+
}
7680
}
7781
}
7882
}

0 commit comments

Comments
 (0)