File tree Expand file tree Collapse file tree
Assets/Editor Toolbox/Editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23
34using UnityEditor ;
45
@@ -14,6 +15,9 @@ namespace Toolbox.Editor
1415 [ CanEditMultipleObjects ]
1516 public class ToolboxEditor : Editor
1617 {
18+ private readonly HashSet < string > propertiesToIgnore = new HashSet < string > ( ) ;
19+
20+
1721 /// <summary>
1822 /// Inspector GUI re-draw call.
1923 /// </summary>
@@ -37,13 +41,18 @@ public override sealed void OnInspectorGUI()
3741 }
3842 }
3943
40-
4144 /// <summary>
4245 /// Handles property display process using custom <see cref="Drawers.ToolboxDrawer"/>.
4346 /// </summary>
4447 /// <param name="property">Property to display.</param>
4548 public virtual void DrawCustomProperty ( SerializedProperty property )
4649 {
50+ var propertyPath = property . propertyPath ;
51+ if ( propertiesToIgnore . Contains ( propertyPath ) )
52+ {
53+ return ;
54+ }
55+
4756 ToolboxEditorGui . DrawToolboxProperty ( property ) ;
4857 }
4958
@@ -85,6 +94,22 @@ public virtual void DrawCustomInspector()
8594 DrawDefaultInspector ( ) ;
8695 }
8796
97+ /// <summary>
98+ /// Forces provided <see cref="SerializedProperty"/> to be ignored in the drawing process.
99+ /// </summary>
100+ public void IgnoreProperty ( SerializedProperty property )
101+ {
102+ IgnoreProperty ( property . propertyPath ) ;
103+ }
104+
105+ /// <summary>
106+ /// Forces associated <see cref="SerializedProperty"/> to be ignored in the drawing process.
107+ /// </summary>
108+ public void IgnoreProperty ( string propertyPath )
109+ {
110+ propertiesToIgnore . Add ( propertyPath ) ;
111+ }
112+
88113
89114 public static event Action < Editor > OnBeginToolboxEditor ;
90115 public static event Action < Editor > OnBreakToolboxEditor ;
You can’t perform that action at this time.
0 commit comments