RealDocs

AActor::GetRolePropertyName

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

Description

Returns the FName of the `Role` UPROPERTY (the actor's local net role), allowing reflection-based systems to reference the property without hard-coded strings.

Caveats & Gotchas

  • Like all `Get*PropertyName` helpers in AActor, this is primarily used by the networking and editor subsystems. Gameplay code should access the role via `GetLocalRole()` rather than going through reflection.
  • The returned FName maps to the private `Role` member. Direct access to `Role` from subclasses is intentionally discouraged; use `GetLocalRole()` and `SetRole()` instead.

Signature

static const FName GetRolePropertyName()

Return Type

const FName

Example

Find Role property via reflection C++
FProperty* RoleProp = AActor::StaticClass()->FindPropertyByName(
    AActor::GetRolePropertyName()
);
check(RoleProp);

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.