From 982e8df9b66cffd48ceba99195830600614b2145 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Fri, 5 Aug 2022 08:51:33 +0200 Subject: [PATCH] Fix TextureBrush to return valid size if texture is not yet loaded --- Flax.sln.DotSettings | 1 + Source/Engine/UI/GUI/Brushes/TextureBrush.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Flax.sln.DotSettings b/Flax.sln.DotSettings index f9c066bae..0808c4488 100644 --- a/Flax.sln.DotSettings +++ b/Flax.sln.DotSettings @@ -237,6 +237,7 @@ True True True + True True True True diff --git a/Source/Engine/UI/GUI/Brushes/TextureBrush.cs b/Source/Engine/UI/GUI/Brushes/TextureBrush.cs index 3aa161d0e..96cae3f18 100644 --- a/Source/Engine/UI/GUI/Brushes/TextureBrush.cs +++ b/Source/Engine/UI/GUI/Brushes/TextureBrush.cs @@ -37,7 +37,7 @@ namespace FlaxEngine.GUI } /// - public Float2 Size => Texture?.Size ?? Float2.Zero; + public Float2 Size => Texture != null && !Texture.WaitForLoaded() ? Texture.Size : Float2.Zero; /// public void Draw(Rectangle rect, Color color)