UActorComponent::PostRename
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtualoverride
Description
Called immediately after this component has been renamed. The base implementation updates the owning actor's `OwnedComponents` set to reflect the new name.
Caveats & Gotchas
- • A `bRoutedPostRename` flag is set by the engine to ensure the super chain is called. If you override this and do not call `Super::PostRename`, an ensure will fire and the actor's component registry will be left stale.
- • The old outer may already be null or invalid by the time this is called — do not dereference `OldOuter` without a null check.
Signature
ENGINE_API virtual void PostRename(UObject* OldOuter, const FName OldName) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OldOuter | UObject* | The previous outer object before the rename. | — |
| OldName | const FName | The previous name of the component before the rename. | — |
Return Type
void Example
Override to update internal name cache C++
void UMyComponent::PostRename(UObject* OldOuter, const FName OldName)
{
Super::PostRename(OldOuter, OldName); // Required — updates OwnedComponents
// Update any internal caches that stored the old name
CachedComponentName = GetFName();
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?