Actor naming without string copy fix

This commit is contained in:
Mateusz Karbowiak
2024-06-22 15:14:02 +02:00
parent 02403377cd
commit 5f4aee71b8
2 changed files with 14 additions and 0 deletions

View File

@@ -543,6 +543,15 @@ void Actor::SetLayerRecursive(int32 layerIndex)
OnLayerChanged();
}
void Actor::SetName(String&& value)
{
if (_name == value)
return;
_name = MoveTemp(value);
if (GetScene())
Level::callActorEvent(Level::ActorEventType::OnActorNameChanged, this, nullptr);
}
void Actor::SetName(const StringView& value)
{
if (_name == value)

View File

@@ -181,6 +181,11 @@ public:
return _name;
}
/// <summary>
/// Sets the actor name without copying the string.
/// </summary>
API_FUNCTION() void SetName(String&& value);
/// <summary>
/// Sets the actor name.
/// </summary>