diff --git a/Source/Engine/Scripting/ScriptingObjectReference.h b/Source/Engine/Scripting/ScriptingObjectReference.h
index a71d22eae..58fed7668 100644
--- a/Source/Engine/Scripting/ScriptingObjectReference.h
+++ b/Source/Engine/Scripting/ScriptingObjectReference.h
@@ -33,6 +33,13 @@ public:
{
}
+ ScriptingObjectReferenceBase(ScriptingObjectReferenceBase&& other) noexcept
+ : _object(nullptr)
+ {
+ OnSet(other._object);
+ other.OnSet(nullptr);
+ }
+
///
/// Initializes a new instance of the class.
///
@@ -96,6 +103,16 @@ protected:
void OnSet(ScriptingObject* object);
void OnDeleted(ScriptingObject* obj);
+
+ ScriptingObjectReferenceBase& operator=(ScriptingObjectReferenceBase&& other) noexcept
+ {
+ if (this != &other)
+ {
+ OnSet(other._object);
+ other.OnSet(nullptr);
+ }
+ return *this;
+ }
};
///
@@ -133,6 +150,11 @@ public:
{
}
+ ScriptingObjectReference(ScriptingObjectReference&& other) noexcept
+ : ScriptingObjectReferenceBase(MoveTemp(other))
+ {
+ }
+
///
/// Finalizes an instance of the class.
///
@@ -173,6 +195,12 @@ public:
return *this;
}
+ ScriptingObjectReference& operator=(ScriptingObjectReference&& other) noexcept
+ {
+ ScriptingObjectReferenceBase::operator=(MoveTemp(other));
+ return *this;
+ }
+
FORCE_INLINE ScriptingObjectReference& operator=(const Guid& id)
{
OnSet(static_cast(FindObject(id, T::GetStaticClass())));