@@ -109,6 +109,8 @@ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2, object mat
109
109
var penWidth = pen . Width ;
110
110
111
111
if ( penColor . A <= 0 || penWidth <= 0 ) return ;
112
+ if ( UE . Event . current . type != UE . EventType . repaint )
113
+ return ;
112
114
113
115
var unityColor = penColor . ToUnityColor ( ) ;
114
116
@@ -234,6 +236,8 @@ public void DrawRectangle(Pen pen, float x, float y, float width, float height,
234
236
var penWidth = pen . Width ;
235
237
236
238
if ( penColor . A <= 0 || penWidth <= 0 ) return ;
239
+ if ( UE . Event . current . type != UE . EventType . repaint )
240
+ return ;
237
241
238
242
var color = penColor . ToUnityColor ( ) ;
239
243
var penDash = pen . DashStyle ;
@@ -293,6 +297,9 @@ public void DrawString(string text, Font font, Color color, float x, float y, fl
293
297
{
294
298
if ( text == null || font == null ) return ;
295
299
300
+ if ( UE . Event . current . type != UE . EventType . repaint )
301
+ return ;
302
+
296
303
// TODO: material not supported.
297
304
298
305
// Set align.
@@ -356,6 +363,9 @@ public void FillRectangle(Color color, float x, float y, float width, float heig
356
363
if ( color . A <= 0 )
357
364
return ;
358
365
366
+ if ( UE . Event . current . type != UE . EventType . repaint )
367
+ return ;
368
+
359
369
var rect = new UE . Rect ( x , y , width , height ) ;
360
370
361
371
if ( material == null || material is UE . Material == false )
0 commit comments