From 5a35c4ad7439c0816080082797f79d1ddfd7c7af Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 8 Oct 2021 15:31:34 +0200 Subject: [PATCH] Add setter to `Control.Center` --- Source/Engine/UI/GUI/Control.Bounds.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/Control.Bounds.cs b/Source/Engine/UI/GUI/Control.Bounds.cs index 717b3c4d7..7139a2e05 100644 --- a/Source/Engine/UI/GUI/Control.Bounds.cs +++ b/Source/Engine/UI/GUI/Control.Bounds.cs @@ -236,7 +236,12 @@ namespace FlaxEngine.GUI /// /// Gets center position of the control relative to the upper-left corner of its container. /// - public Vector2 Center => _bounds.Center; + [HideInEditor, NoSerialize] + public Vector2 Center + { + get => _bounds.Center; + set => Location = value - Size * 0.5f; + } /// /// Gets or sets control's bounds rectangle.