Minor improvements

This commit is contained in:
Wojciech Figat
2022-10-25 15:07:04 +02:00
parent 044e141848
commit cd4d15e0e2
2 changed files with 15 additions and 3 deletions

View File

@@ -88,13 +88,13 @@ public:
/// <param name="other">The other.</param> /// <param name="other">The other.</param>
SoftAssetReference(const SoftAssetReference& other) SoftAssetReference(const SoftAssetReference& other)
{ {
OnSet(other.Get()); OnSet(other.GetID());
} }
SoftAssetReference(SoftAssetReference&& other) SoftAssetReference(SoftAssetReference&& other)
{ {
OnSet(other.Get()); OnSet(other.GetID());
other.OnSet(nullptr); other.OnSet(Guid::Empty);
} }
/// <summary> /// <summary>

View File

@@ -317,6 +317,18 @@ public:
return result; return result;
} }
/// <summary>
/// Creates a new script of a specific type and adds it to the actor.
/// </summary>
/// <returns>The created script instance, null otherwise.</returns>
template<typename T>
T* AddScript()
{
auto script = New<T>();
script->SetParent(this);
return script;
}
public: public:
/// <summary> /// <summary>
/// Gets value indicating if actor is active in the scene. /// Gets value indicating if actor is active in the scene.