AActor::PostRename
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualoverride
Description
Called by the engine immediately after an actor (or its outer) is renamed. Override to react to rename events such as updating cached names or references that depend on the actor's FName.
Caveats & Gotchas
- • Always call Super::PostRename() in your override — the base implementation updates internal tracking structures in the world and level.
- • This fires for outer changes as well as name changes; check whether OldOuter differs from GetOuter() before assuming only the name changed.
- • Not called during normal gameplay renames triggered by gameplay code — this is a UObject-level rename hook, primarily relevant in editor and serialization contexts.
Signature
ENGINE_API virtual void PostRename( UObject* OldOuter, const FName OldName ) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OldOuter | UObject* | The outer object the actor belonged to before renaming. | — |
| OldName | const FName | The name the actor held before renaming. | — |
Return Type
void Example
Override to update a cached name C++
void AMyActor::PostRename(UObject* OldOuter, const FName OldName)
{
Super::PostRename(OldOuter, OldName);
// Refresh any system that caches this actor's name
CachedActorName = GetFName();
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?