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 @@ -46,6 +46,9 @@ static ToolboxEditorToolbar()
4646 private static readonly FieldInfo onGuiHandler = containterType . GetField ( "m_OnGUIHandler" ,
4747 BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
4848
49+ private static readonly MethodInfo repaintMethod = toolbarType . GetMethod ( "RepaintToolbar" ,
50+ BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Static ) ;
51+
4952 private static Object toolbar ;
5053
5154 private static IEnumerator Initialize ( )
@@ -106,7 +109,7 @@ private static IEnumerator Initialize()
106109
107110 private static void OnGui ( )
108111 {
109- if ( ! IsToolbarAllowed || OnToolbarGui == null )
112+ if ( ! IsToolbarAllowed || ! IsToolbarValid )
110113 {
111114 return ;
112115 }
@@ -142,9 +145,18 @@ private static void OnGui()
142145#endif
143146 }
144147
148+ public static void Repaint ( )
149+ {
150+ if ( toolbar == null )
151+ {
152+ return ;
153+ }
154+
155+ repaintMethod ? . Invoke ( toolbar , null ) ;
156+ }
145157
146158 public static bool IsToolbarAllowed { get ; set ; } = true ;
147-
159+ public static bool IsToolbarValid => toolbar != null && OnToolbarGui != null ;
148160 public static float FromToolsOffset { get ; set ; } = 400.0f ;
149161 public static float FromStripOffset { get ; set ; } = 150.0f ;
150162
You can’t perform that action at this time.
0 commit comments