UObject::GetName
#include "UObject/UObjectBaseUtility.h"
Access: public
Description
Returns the object's name without any path or package prefix as an FString, e.g. 'BP_Player_C_0'. Allocates a new string on every call; prefer GetFName() when only an FName is needed.
Signature
UE_FORCEINLINE_HINT FString GetName() const Return Type
FString Caveats & Gotchas
- • Allocates a new FString on every call by converting from the internal FName. Use GetFName() when you only need the FName for hashing or comparison and want to avoid the allocation.
- • For the full path including package, use GetPathName() or GetFullName() instead.
- • The name includes the numeric suffix appended for instanced objects (e.g. 'MyActor_5'). Use GetFName().GetPlainNameString() for the base name without the suffix.
Example
Print object name C++
UE_LOG(LogTemp, Log, TEXT("Object: %s"), *SomeObject->GetName()); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?