From 0f8653709919bf1262b2add4df69eb4ef088a6ca Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 3 Jun 2026 11:01:14 +0200 Subject: [PATCH] Add simpler `Variant::Enum` that auto-setups variant type from enum scripting info --- Source/Engine/Core/Types/Variant.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Engine/Core/Types/Variant.h b/Source/Engine/Core/Types/Variant.h index 530a4da76..9532d4ec4 100644 --- a/Source/Engine/Core/Types/Variant.h +++ b/Source/Engine/Core/Types/Variant.h @@ -421,6 +421,15 @@ public: return MoveTemp(v); } + template + static typename TEnableIf::Value, Variant>::Type Enum(const T value) + { + Variant v; + v.SetType(VariantType(VariantType::Enum, StaticType().GetType())); + v.AsUint64 = (uint64)value; + return MoveTemp(v); + } + template static typename TEnableIf::Value && !TIsPointer::Value, Variant>::Type Structure(VariantType&& type, const T& value) {