diff --git a/Source/Engine/UI/GUI/Common/Button.cs b/Source/Engine/UI/GUI/Common/Button.cs index ff0b776f9..aa4c182cb 100644 --- a/Source/Engine/UI/GUI/Common/Button.cs +++ b/Source/Engine/UI/GUI/Common/Button.cs @@ -62,6 +62,18 @@ namespace FlaxEngine.GUI [EditorDisplay("Text Style"), EditorOrder(2020)] public Color TextColor; + /// + /// Gets or sets the horizontal text alignment within the control bounds. + /// + [EditorDisplay("Text Style"), EditorOrder(2027)] + public TextAlignment HorizontalAlignment { get; set; } = TextAlignment.Center; + + /// + /// Gets or sets the vertical text alignment within the control bounds. + /// + [EditorDisplay("Text Style"), EditorOrder(2028)] + public TextAlignment VerticalAlignment { get; set; } = TextAlignment.Center; + /// /// Gets or sets the brush used for background drawing. /// @@ -262,7 +274,7 @@ namespace FlaxEngine.GUI Render2D.DrawRectangle(clientRect, borderColor, BorderThickness); // Draw text - Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center); + Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, HorizontalAlignment, VerticalAlignment); } ///