// GUI function for the side bar void DrawSideBarGUI() { EditorGUIUtility.wideMode = true; EditorGUILayout.BeginVertical(GUILayout.MinWidth(336)); _scrollSide = EditorGUILayout.BeginScrollView(_scrollSide); // Determine the active node. var activeNode = GetActiveNode(); // Destroy the previous property editor if it's not needed. if (_propertyEditor != null) { var targetNodeInstance = (Wiring.NodeBase)_propertyEditor.target; if (activeNode == null || !activeNode.IsRepresentationOf(targetNodeInstance)) { DestroyImmediate(_propertyEditor); _propertyEditor = null; // This is needed to clear the UnityEventDrawer cache. EditorUtility.ClearPropertyDrawerCache(); } } if (activeNode != null) { // Name field EditorGUILayout.LabelField("Node Attributes", EditorStyles.boldLabel); activeNode.DrawNameFieldGUI(); EditorGUILayout.Space(); // Show the property editor. EditorGUILayout.LabelField(activeNode.typeName + " Properties", EditorStyles.boldLabel); if (_propertyEditor == null) { _propertyEditor = activeNode.CreateEditor(); } _propertyEditor.OnInspectorGUI(); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }
private void DrawNodeInspector() { var activeNode = Node.ActiveNode; // Destroy the previous property editor if it's not needed. if (_propertyEditor != null) { var targetNodeInstance = (NodeBase)_propertyEditor.target; if (activeNode != null && !activeNode.IsRepresentationOf(targetNodeInstance)) { DestroyImmediate(_propertyEditor); _propertyEditor = null; // This is needed to clear the UnityEventDrawer cache. EditorUtility.ClearPropertyDrawerCache(); } } //EditorGUIUtility.labelWidth = 150; // Name field if (activeNode != null) { EditorGUILayout.LabelField("Node Attributes", EditorStyles.boldLabel); activeNode.DrawNameFieldGUI(); EditorGUILayout.Space(); // Show the property editor. EditorGUILayout.LabelField(activeNode.typeName + " Properties", EditorStyles.boldLabel); if (_propertyEditor == null) { _propertyEditor = activeNode.CreateEditor(); } _propertyEditor.OnInspectorGUI(); } }