Skip to content

Commit f86e04a

Browse files
committed
reverting repainting changes: Unity is using additional Events for GUI.TextArea/GUI.TextField.
Need to complete TextBoxBase class and remove Unity input fields usage.
1 parent 064b7b7 commit f86e04a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Unity/API/UnityGdi.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2, object mat
109109
var penWidth = pen.Width;
110110

111111
if (penColor.A <= 0 || penWidth <= 0) return;
112+
if (UE.Event.current.type != UE.EventType.repaint)
113+
return;
112114

113115
var unityColor = penColor.ToUnityColor();
114116

@@ -234,6 +236,8 @@ public void DrawRectangle(Pen pen, float x, float y, float width, float height,
234236
var penWidth = pen.Width;
235237

236238
if (penColor.A <= 0 || penWidth <= 0) return;
239+
if (UE.Event.current.type != UE.EventType.repaint)
240+
return;
237241

238242
var color = penColor.ToUnityColor();
239243
var penDash = pen.DashStyle;
@@ -293,6 +297,9 @@ public void DrawString(string text, Font font, Color color, float x, float y, fl
293297
{
294298
if (text == null || font == null) return;
295299

300+
if (UE.Event.current.type != UE.EventType.repaint)
301+
return;
302+
296303
// TODO: material not supported.
297304

298305
// Set align.
@@ -356,6 +363,9 @@ public void FillRectangle(Color color, float x, float y, float width, float heig
356363
if (color.A <= 0)
357364
return;
358365

366+
if (UE.Event.current.type != UE.EventType.repaint)
367+
return;
368+
359369
var rect = new UE.Rect(x, y, width, height);
360370

361371
if (material == null || material is UE.Material == false)

Unity/UnityWinForms.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ private void OnGUI()
282282
UE.Quaternion.AngleAxis(0, UE.Vector3.up),
283283
new UE.Vector3(scaleX, scaleY, 1));
284284

285-
if (UE.Event.current.type == UE.EventType.repaint)
286-
controller.Redraw();
285+
controller.Redraw();
287286
}
288287
}
289288
}

0 commit comments

Comments
 (0)