protected void DrawProperty(Rect position, SerializedProperty property) { // Try to get the sortable list this property belongs to var listData = GetReorderableListData(property); UnityEditor.Editor scriptableEditor; var isScriptableEditor = editableIndex.TryGetValue(property.propertyPath, out scriptableEditor); // Has ReorderableList if (listData != null) { // Try to show the list if (!listData.DoProperty(position, property)) { EditorGUI.PropertyField(position, property, false); position.y += EditorGUI.GetPropertyHeight(property, false); if (property.isExpanded) { EditorGUI.indentLevel++; IterateDrawProperty(position, property.Copy()); EditorGUI.indentLevel--; } } } // Else try to draw ScriptableObject editor else if (isScriptableEditor) { bool hasHeader = property.HasAttribute <HeaderAttribute>(); bool hasSpace = property.HasAttribute <SpaceAttribute>(); hasSpace |= hasHeader; // No data in property, draw property field with create button if (scriptableEditor == null) { var objPosition = new Rect(position); var btnPosition = new Rect(position); objPosition.xMax -= hasSpace ? 66 : 56; btnPosition.xMin = btnPosition.xMax - 56; EditorGUI.PropertyField(objPosition, property, false); var doCreate = GUI.Button(btnPosition, Create, EditorStyles.miniButton); if (doCreate) { var propType = property.GetTypeReflection(); ScriptableObjectUtility.CreateAssetWithSavePrompt(propType, postCreated: createdAsset => { property.objectReferenceValue = createdAsset; property.isExpanded = true; return(false); }); } } // Has data in property, draw foldout and editor else { EasyGUI.TryDrawObjectReference(position, property, new GUIContent(property.displayName), true); } } else { var isStartProp = property.propertyPath.StartsWith(M_ScriptStr); if (isStartProp && IgnoreHeader) { } else { using (new EditorGUI.DisabledScope(isStartProp)) { EditorGUI.PropertyField(position, property, property.isExpanded); } } } }