From 06250fcb6d1ab6101530aae2a15517ad60cae6b1 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 30 Jul 2023 20:39:45 +0300 Subject: [PATCH 1/2] Implement a generic version of `AssetReferenceAttribute` --- .../Editor/AssetReferenceAttribute.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs b/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs index 62040d224..6d6107588 100644 --- a/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs +++ b/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs @@ -53,4 +53,21 @@ namespace FlaxEngine UseSmallPicker = useSmallPicker; } } + + /// + /// Specifies a options for an asset reference picker in the editor. Allows to customize view or provide custom value assign policy. + /// + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class AssetReferenceAttribute : AssetReferenceAttribute + { + /// + /// Initializes a new instance of the class for generic type T. + /// + /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. + public AssetReferenceAttribute(bool useSmallPicker = false) + : base(typeof(T), useSmallPicker) + { + } + } } From bf351f71bfe933c7a37b06e438298a84c1ebc27d Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 30 Jul 2023 20:48:18 +0300 Subject: [PATCH 2/2] Guard generic `AssetReferenceAttribute` to work only in .NET 7 --- .../Scripting/Attributes/Editor/AssetReferenceAttribute.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs b/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs index 6d6107588..5bb79b81b 100644 --- a/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs +++ b/Source/Engine/Scripting/Attributes/Editor/AssetReferenceAttribute.cs @@ -54,6 +54,7 @@ namespace FlaxEngine } } +#if USE_NETCORE /// /// Specifies a options for an asset reference picker in the editor. Allows to customize view or provide custom value assign policy. /// @@ -70,4 +71,5 @@ namespace FlaxEngine { } } +#endif }