Using draw default inspector (#1559)

* adding IsParameterControlledByCurve check

* using DrawDefaultInspector

Now that SyncVar has a drawer this code is redundant
This commit is contained in:
James Frowen 2020-03-19 23:29:55 +00:00 committed by GitHub
parent e946c79194
commit b4ff4f2ce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,8 @@ public class NetworkBehaviourInspector : Editor
bool syncsAnything; bool syncsAnything;
bool[] showSyncLists; bool[] showSyncLists;
// this might be able to be removed right away as it is internal and has no references
[System.Obsolete("Override OnInspectorGUI instead")]
internal virtual bool HideScriptField => false; internal virtual bool HideScriptField => false;
// does this type sync anything? otherwise we don't need to show syncInterval // does this type sync anything? otherwise we don't need to show syncInterval
@ -95,35 +97,7 @@ public override void OnInspectorGUI()
Init(targetScript); Init(targetScript);
} }
EditorGUI.BeginChangeCheck(); DrawDefaultInspector();
serializedObject.Update();
// Loop through properties and create one field (including children) for each top level property.
SerializedProperty property = serializedObject.GetIterator();
bool expanded = true;
while (property.NextVisible(expanded))
{
if (property.name == "m_Script")
{
if (HideScriptField)
{
continue;
}
EditorGUI.BeginDisabledGroup(true);
}
EditorGUILayout.PropertyField(property, true);
if (property.name == "m_Script")
{
EditorGUI.EndDisabledGroup();
}
expanded = false;
}
serializedObject.ApplyModifiedProperties();
EditorGUI.EndChangeCheck();
// find SyncLists.. they are not properties. // find SyncLists.. they are not properties.
int syncListIndex = 0; int syncListIndex = 0;