Description
Directly sets the actor's net role without triggering any side effects. The engine normally manages roles automatically during actor creation and replication.
Caveats & Gotchas
- • Manually calling this at runtime can break engine expectations — the net driver and replication system derive ownership and relevancy decisions from Role, and an incorrect value will cause mispredictions and silent replication failures.
- • This is a low-level accessor introduced to allow the role field to become private in a future engine version; it exists so transition code compiles without accessing the field directly.
- • Prefer to let the engine set roles automatically; only call this in tooling, migration code, or when you are certain you understand the full downstream impact.
Signature
ENGINE_API void SetRole(ENetRole InRole) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InRole | ENetRole | The net role to assign to this actor (e.g. ROLE_Authority, ROLE_SimulatedProxy, ROLE_AutonomousProxy). | — |
Return Type
void Example
Force authority role in a test harness C++
// Only in test/tooling contexts — do not use in shipping gameplay code
void UMyNetTestHelper::ForceAuthority(AActor* Actor)
{
if (Actor)
{
Actor->SetRole(ROLE_Authority);
}
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?