diff --git a/Source/Engine/Content/SoftAssetReference.h b/Source/Engine/Content/SoftAssetReference.h index dd1251d61..dd07d9099 100644 --- a/Source/Engine/Content/SoftAssetReference.h +++ b/Source/Engine/Content/SoftAssetReference.h @@ -88,13 +88,13 @@ public: /// The other. SoftAssetReference(const SoftAssetReference& other) { - OnSet(other.Get()); + OnSet(other.GetID()); } SoftAssetReference(SoftAssetReference&& other) { - OnSet(other.Get()); - other.OnSet(nullptr); + OnSet(other.GetID()); + other.OnSet(Guid::Empty); } /// diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index e9ad7793c..e6229c0a3 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -317,6 +317,18 @@ public: return result; } + /// + /// Creates a new script of a specific type and adds it to the actor. + /// + /// The created script instance, null otherwise. + template + T* AddScript() + { + auto script = New(); + script->SetParent(this); + return script; + } + public: /// /// Gets value indicating if actor is active in the scene.