RealDocs

AActor::Rename

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtualoverride

Description

Renames this actor within the object system, optionally re-outering it to a different level or package. AActor overrides this to keep its label and network name consistent with the UObject name.

Caveats & Gotchas

  • Rename() operates on the internal UObject name, not the actor label shown in the editor — to change the label visible in the Outliner use SetActorLabel() instead. Confusing the two is a common mistake.
  • Renaming an actor that is being replicated can break net GUIDs and cause clients to lose their reference to the actor. Always rename replicated actors before play begins or coordinate with the replication system.

Signature

ENGINE_API virtual bool Rename( const TCHAR* NewName=nullptr, UObject* NewOuter=nullptr, ERenameFlags Flags=REN_None ) override;

Parameters

Name Type Description Default
NewName const TCHAR* The new object name, or null to auto-generate a unique name. nullptr
NewOuter UObject* The new outer object (package or level), or null to keep the current outer. nullptr
Flags ERenameFlags Bitmask of rename options (e.g. REN_DontCreateRedirectors, REN_NonTransactional). REN_None

Return Type

bool

Example

Move an actor to a different level package C++
// Move actor to a streaming level's package (editor utility context)
ULevel* TargetLevel = ...;
bool bSuccess = MyActor->Rename(nullptr, TargetLevel, REN_DontCreateRedirectors);
if (!bSuccess)
{
    UE_LOG(LogTemp, Warning, TEXT("Failed to rename/re-outer actor"));
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.