protected override void DrawTree() { if (customTree == null) { customTree = PropertyTree.Create(serializedObject); } InspectorUtilities.BeginDrawPropertyTree(customTree, true); InspectorUtilities.DrawPropertiesInTree(customTree); InspectorUtilities.EndDrawPropertyTree(customTree); }
protected override void DrawPropertyLayout(GUIContent label) { var target = Property.ValueEntry.WeakSmartValue as Object; if (target != null) { foldout.Value = EditorGUILayout.Foldout(foldout.Value, new GUIContent(typeof(T).GetNiceName().Replace("Effect", string.Empty))); if (SirenixEditorGUI.BeginFadeGroup(this, foldout.Value)) { InspectorUtilities.BeginDrawPropertyTree(tree, true); InspectorUtilities.DrawPropertiesInTree(tree); InspectorUtilities.EndDrawPropertyTree(tree); } SirenixEditorGUI.EndFadeGroup(); } }
protected override void DrawTree() { EditorGUILayout.BeginHorizontal(); var size = EditorGUIUtility.singleLineHeight; if (GUILayout.Button(type == null ? " None" : $" {GetEffectName(type)}", EditorStyles.popup)) { var rect = GUIHelper.GetCurrentLayoutRect(); var position = new Vector2(rect.x, rect.yMax); var window = dropdown.ShowInPopup(position, rect.width - size - 3f); window.OnClose += dropdown.SelectionTree.Selection.ConfirmSelection; } if (GUILayout.Button(EditorIcons.Plus.ActiveGUIContent, SirenixGUIStyles.IconButton, GUILayout.Width(size), GUILayout.Height(size))) { if (type == null) { return; } var component = target as Component; var addedComponent = component.gameObject.AddComponent(type); addedComponent.hideFlags = HideFlags.HideInInspector; var feedbacksProperty = serializedObject.FindProperty("feedbacks"); var index = feedbacksProperty.arraySize; feedbacksProperty.InsertArrayElementAtIndex(index); var element = feedbacksProperty.GetArrayElementAtIndex(index); element.objectReferenceValue = addedComponent; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(size / 3f); Tree.DrawMonoScriptObjectField = false; InspectorUtilities.BeginDrawPropertyTree(Tree, true); InspectorUtilities.DrawPropertiesInTree(Tree); InspectorUtilities.EndDrawPropertyTree(Tree); }