diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs
index 8e046ecde..0a4114205 100644
--- a/Source/Engine/UI/GUI/ContainerControl.cs
+++ b/Source/Engine/UI/GUI/ContainerControl.cs
@@ -622,7 +622,18 @@ namespace FlaxEngine.GUI
public override void Draw()
{
DrawSelf();
- DrawChildren();
+
+ if (ClipChildren)
+ {
+ GetDesireClientArea(out var clientArea);
+ Render2D.PushClip(ref clientArea);
+ DrawChildren();
+ Render2D.PopClip();
+ }
+ else
+ {
+ DrawChildren();
+ }
}
///
@@ -630,21 +641,14 @@ namespace FlaxEngine.GUI
///
public virtual void DrawSelf()
{
- base.Draw();
+ base.Draw();
}
-
+
///
/// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area.
///
protected virtual void DrawChildren()
{
- // Push clipping mask
- if (ClipChildren)
- {
- GetDesireClientArea(out var clientArea);
- Render2D.PushClip(ref clientArea);
- }
-
// Draw all visible child controls
if (CullChildren)
{
@@ -679,12 +683,6 @@ namespace FlaxEngine.GUI
}
}
}
-
- // Pop clipping mask
- if (ClipChildren)
- {
- Render2D.PopClip();
- }
}
///