File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Assets/Editor Toolbox/Editor Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ static ToolboxEditorToolbar()
46
46
private static readonly FieldInfo onGuiHandler = containterType . GetField ( "m_OnGUIHandler" ,
47
47
BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
48
48
49
+ private static readonly MethodInfo repaintMethod = toolbarType . GetMethod ( "RepaintToolbar" ,
50
+ BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Static ) ;
51
+
49
52
private static Object toolbar ;
50
53
51
54
private static IEnumerator Initialize ( )
@@ -106,7 +109,7 @@ private static IEnumerator Initialize()
106
109
107
110
private static void OnGui ( )
108
111
{
109
- if ( ! IsToolbarAllowed || OnToolbarGui == null )
112
+ if ( ! IsToolbarAllowed || ! IsToolbarValid )
110
113
{
111
114
return ;
112
115
}
@@ -142,9 +145,18 @@ private static void OnGui()
142
145
#endif
143
146
}
144
147
148
+ public static void Repaint ( )
149
+ {
150
+ if ( toolbar == null )
151
+ {
152
+ return ;
153
+ }
154
+
155
+ repaintMethod ? . Invoke ( toolbar , null ) ;
156
+ }
145
157
146
158
public static bool IsToolbarAllowed { get ; set ; } = true ;
147
-
159
+ public static bool IsToolbarValid => toolbar != null && OnToolbarGui != null ;
148
160
public static float FromToolsOffset { get ; set ; } = 400.0f ;
149
161
public static float FromStripOffset { get ; set ; } = 150.0f ;
150
162
You can’t perform that action at this time.
0 commit comments