private void DrawField() { var isPropertyEnabled = this.IsEnabled(); // Draw the field EditorGUI.BeginChangeCheck(); GUI.enabled = isPropertyEnabled; PropertyDrawer drawer = null; DrawerAttribute attribute = null; var drawerAttributes = this.GetCustomAttributes <DrawerAttribute>().ToArray(); if (drawerAttributes.Length > 0) { attribute = drawerAttributes[0]; drawer = PropertyDrawerDatabase.GetDrawerForAttribute(attribute.GetType()); } if (this.HasChildren) { this.foldout = EditorGUILayout.Foldout(this.foldout, this.DisplayName); if (this.foldout) { EditorGUI.indentLevel += 1; this.DrawPropertyField(drawer, attribute); EditorGUI.indentLevel -= 1; } } else if (this.IsArray) { this.foldout = EditorGUILayout.Foldout(this.foldout, this.DisplayName); if (this.foldout) { this.DrawPropertyField(drawer, attribute); } } else { this.DrawPropertyField(drawer, attribute); } GUI.enabled = true; if (EditorGUI.EndChangeCheck()) { this.OnEndChangeCheck(); } }
/// <inheritdoc /> protected override void DrawPropertyField(PropertyDrawer drawer, DrawerAttribute attribute) { if (this.HasChildren) { this.childDrawer.OnInspectorGUI(); } else if (this.IsArray) { ListPropertyDrawer.Instance.DrawArray(this.Property); } else { if (drawer == null || attribute == null) { this.DrawDefaultField(); } else { drawer.Run(this, attribute); } } }
/// <inheritdoc /> protected override void DrawPropertyField(PropertyDrawer drawer, DrawerAttribute attribute) { if (this.isArray) { return; } if (this.HasChildren) { this.childDrawer.OnInspectorGUI(); } else { if (drawer == null || attribute == null) { this.DrawDefaultField(); } else { drawer.Run(this, attribute); } } }
protected abstract void DrawPropertyField(PropertyDrawer drawer, DrawerAttribute attribute);