diff --git a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
index b32f58923..ce5207414 100644
--- a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs
@@ -26,6 +26,7 @@ namespace FlaxEditor.CustomEditors.Editors
new OptionType("Texture 9-Slicing", typeof(Texture9SlicingBrush)),
new OptionType("Sprite 9-Slicing", typeof(Sprite9SlicingBrush)),
new OptionType("Video", typeof(VideoBrush)),
+ new OptionType("UI Brush", typeof(UIBrush)),
};
}
}
diff --git a/Source/Engine/UI/GUI/Brushes/UIBrush.cs b/Source/Engine/UI/GUI/Brushes/UIBrush.cs
new file mode 100644
index 000000000..4441899c0
--- /dev/null
+++ b/Source/Engine/UI/GUI/Brushes/UIBrush.cs
@@ -0,0 +1,75 @@
+// Copyright (c) Wojciech Figat. All rights reserved.
+
+namespace FlaxEngine.GUI
+{
+ ///
+ /// Asset with that can be reused in different UI controls.
+ ///
+ ///
+ ///
+ public class UIBrushAsset
+ {
+ ///
+ /// Brush object.
+ ///
+ public IBrush Brush;
+ }
+
+ ///
+ /// Implementation of for frame displaying.
+ ///
+ ///
+ ///
+ public sealed class UIBrush : IBrush
+ {
+ ///
+ /// The UI Brush asset to use.
+ ///
+ public JsonAssetReference Asset;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public UIBrush()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The UI Brush asset to use.
+ public UIBrush(JsonAssetReference asset)
+ {
+ Asset = asset;
+ }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The UI Brush asset to use.
+ public UIBrush(JsonAsset asset)
+ {
+ Asset = asset;
+ }
+
+ ///
+ public Float2 Size
+ {
+ get
+ {
+ var asset = (UIBrushAsset)Asset.Asset?.Instance;
+ if (asset != null && asset.Brush != null)
+ return asset.Brush.Size;
+ return Float2.Zero;
+ }
+ }
+
+ ///
+ public void Draw(Rectangle rect, Color color)
+ {
+ var asset = (UIBrushAsset)Asset.Asset?.Instance;
+ if (asset != null && asset.Brush != null)
+ asset.Brush.Draw(rect, color);
+ }
+ }
+}