Simplify editor a bit

This commit is contained in:
Paul Pacheco 2019-10-30 05:49:04 -07:00
parent d9afbfe4c9
commit 6cbef06e00

View File

@ -16,29 +16,21 @@ public class NetworkIdentityEditor : Editor
readonly GUIContent spawnLabel = new GUIContent("Spawn Object", "This causes an unspawned server object to be spawned on clients");
NetworkIdentity networkIdentity;
bool initialized;
bool showObservers;
void Init()
{
if (initialized)
if (serverOnlyProperty == null)
{
return;
}
initialized = true;
networkIdentity = target as NetworkIdentity;
networkIdentity = target as NetworkIdentity;
serverOnlyProperty = serializedObject.FindProperty("serverOnly");
localPlayerAuthorityProperty = serializedObject.FindProperty("localPlayerAuthority");
serverOnlyProperty = serializedObject.FindProperty("serverOnly");
localPlayerAuthorityProperty = serializedObject.FindProperty("localPlayerAuthority");
}
}
public override void OnInspectorGUI()
{
if (serverOnlyProperty == null)
{
initialized = false;
}
Init();
serializedObject.Update();