diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index a30a929de..1cdfccd3b 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -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) diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index dc77cdbee..fdf587b07 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -181,6 +181,11 @@ public: return _name; } + /// + /// Sets the actor name without copying the string. + /// + API_FUNCTION() void SetName(String&& value); + /// /// Sets the actor name. ///