AActor::SetNetCullDistanceSquared
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTION
Description
Sets the squared net cull distance for this actor. Actors farther than the square root of this value from a client's viewpoint will not be replicated to that client.
Caveats & Gotchas
- • The value is stored and compared in squared space for performance — pass the square of the desired distance in Unreal Units. For example, to cull at 5000 UU, pass 25000000.0f.
- • The `NetCullDistanceSquared` property itself was deprecated in UE 5.5 as a publicly writable field; always use this setter and `GetNetCullDistanceSquared()` instead. The underlying UPROPERTY still exists but is marked `AllowPrivateAccess`.
Signature
ENGINE_API void SetNetCullDistanceSquared(float DistanceSq) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DistanceSq | float | Squared maximum distance (in UU²) from the client viewpoint beyond which this actor is not replicated. | — |
Return Type
void Example
Set a 5000 UU replication distance C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
// Replicate to clients within 5000 Unreal Units
SetNetCullDistanceSquared(5000.0f * 5000.0f);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
| 5.5 | stable | Direct UPROPERTY access deprecated; SetNetCullDistanceSquared/GetNetCullDistanceSquared added as the canonical API. |
Feedback
Was this helpful?