AActor::Role is inaccessible error in UE 4.25 fix

Not sure if anyone else runs into this, I’ve got a compile error saying AActor::Role is inaccessible in UE 4.25. (Seems it became private.)

After a bit of poking found GetRolePropertyName(), which also says something about subclasses not needing access to Role on Actors so it can be made private “later”.
So now there are GetlocalRole() and GetRemoteRole() Functions to handle this.

The DrawDebugString call that worked for me was:

DrawDebugString(GetWorld(), FVector(0, 0, 100), GetEnumText(GetLocalRole()), this, FColor::Green, DeltaTime);
5 Likes

THanks for sharing this.

One other thing that may be helpful, UE4 has a built in utility for converting macros to human readable strings in the UEnum class:

FString value;
UEnum::GetValueAsString(GetLocalRole(), value);

DrawDebugString(GetWorld(), FVector(0.0f, 0.0f, 100.0f), value, this, FColor::White, DeltaTime);
4 Likes

Thanks guys, very helpful!