UPROPERTY Specifiers Explained: EditAnywhere, BlueprintReadWrite and More
What every common UPROPERTY specifier does in Unreal Engine C++, which ones combine, the meta tags worth knowing and the mistakes that cause errors.
In this article
UPROPERTY is the first Unreal macro most C++ programmers meet, and the one they search for most. It looks like a decoration, but it decides whether a variable shows up in the editor, whether Blueprints can use it, whether it is saved, replicated and kept alive by the garbage collector. This guide explains the specifiers you will actually use, grouped by what they control.
What UPROPERTY does
Before compiling, the Unreal Header Tool reads every UPROPERTY, UFUNCTION and UCLASS and generates reflection code. Through that code the engine can:
- show and edit the property in the Details panel,
- read and write it from Blueprints,
- serialize it (save, load, copy, undo),
- replicate it over the network,
- see UObject references for garbage collection.
A plain C++ member without UPROPERTY is invisible to all of these.
UCLASS()
class AShopShelf : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Shelf", meta = (ClampMin = "1"))
int32 Capacity = 12;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Shelf")
TObjectPtr<UStaticMeshComponent> Mesh;
};
1. Details panel: Edit vs Visible
Pick one of these six:
| Specifier | Class defaults | Placed instances |
|---|---|---|
EditAnywhere | Editable | Editable |
EditDefaultsOnly | Editable | – |
EditInstanceOnly | – | Editable |
VisibleAnywhere | Read-only | Read-only |
VisibleDefaultsOnly | Read-only | – |
VisibleInstanceOnly | – | Read-only |
Rules of thumb:
- Tuning values shared by all instances (move speed, damage):
EditDefaultsOnly. - Per-instance settings (which product a shelf holds):
EditAnywhereorEditInstanceOnly. - Component pointers:
VisibleAnywhere. The pointer stays fixed, but you can still edit the component's own properties.
2. Blueprint access
Pick one:
| Specifier | Blueprints can |
|---|---|
BlueprintReadWrite | Get and set |
BlueprintReadOnly | Get only |
These are independent from the Edit/Visible group. EditAnywhere, BlueprintReadOnly is a common combination: designers tune it, Blueprints read it, only C++ changes it at runtime.
For more control, BlueprintGetter = GetX and BlueprintSetter = SetX route Blueprint reads and writes through your own UFUNCTIONs, so you can validate values or react to changes.
Private members need AllowPrivateAccess
private:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Shelf", meta = (AllowPrivateAccess = "true"))
TObjectPtr<UBoxComponent> InteractionBox;
Without AllowPrivateAccess, a private property with BlueprintReadWrite or BlueprintReadOnly is a compile error from Unreal Header Tool.
3. Category
Category = "Shelf" groups the property in the Details panel and in Blueprint menus. Use | for sub-categories: Category = "Shelf|Stock". Good categories make a large class much easier for designers.
4. Networking
| Specifier | Meaning |
|---|---|
Replicated | The server sends the value to clients |
ReplicatedUsing = OnRep_Stock | Replicated, and OnRep_Stock() runs on clients when it changes |
NotReplicated | On a struct member: skip it when the struct replicates |
Replicated properties must also be registered:
#include "Net/UnrealNetwork.h"
void AShopShelf::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AShopShelf, Stock);
}
and the actor must replicate (bReplicates = true). The OnRep_ function must be a UFUNCTION().
5. Saving and config
| Specifier | Meaning |
|---|---|
Transient | Never saved; starts zeroed. For runtime-only state |
SaveGame | Included when you serialize with the SaveGame flag (custom save systems) |
Config | Loaded from the class's .ini file (class needs UCLASS(Config = Game)) |
DuplicateTransient | Reset when the object is duplicated |
6. Meta tags worth knowing
meta = (…) adds editor hints:
| Meta | Effect |
|---|---|
ClampMin, ClampMax | Limits typed values |
UIMin, UIMax | Limits the slider range |
Units = "cm" | Shows units (cm, s, kg, Degrees, Percent…) |
EditCondition = "bUseLimit" | Only editable when the condition is true |
EditConditionHides | Hide instead of grey out |
InlineEditConditionToggle | Show the bool as a checkbox next to the property it controls |
DisplayName = "Max Stock" | Nicer name in the editor |
ExposeOnSpawn = "true" | Input pin on Spawn Actor nodes |
MakeEditWidget | 3D gizmo in the viewport for a vector |
TitleProperty = "Name" | Titles for arrays of structs |
Example with an edit condition:
UPROPERTY(EditAnywhere, Category = "Shelf", meta = (InlineEditConditionToggle)) bool bLimitStock = false; UPROPERTY(EditAnywhere, Category = "Shelf", meta = (EditCondition = "bLimitStock", ClampMin = "0")) int32 MaxStock = 50;
7. Garbage collection
Any UObject pointer you store as a member should be a UPROPERTY, even with no specifiers:
UPROPERTY() TObjectPtr<UShopInventory> Inventory;
Otherwise the garbage collector does not know you are using the object and may destroy it, leaving you with a dangling pointer. In Unreal Engine 5, TObjectPtr is the recommended type for UObject member pointers.
Common mistakes
- Two specifiers from one group, like
EditAnywhere, VisibleAnywhere. - BlueprintReadWrite on a private member without
AllowPrivateAccess. - Replicated without
GetLifetimeReplicatedProps, so nothing replicates. ReplicatedUsingpointing to a function that is not aUFUNCTION().- Config property in a class without
UCLASS(Config = …). - Raw UObject pointers without UPROPERTY that get garbage collected.
Build macros without memorising them
The free UPROPERTY & UFUNCTION Specifier Builder lets you tick specifiers and meta tags, keeps groups exclusive, warns about the mistakes above, and generates the extra code (OnRep, GetLifetimeReplicatedProps, _Implementation and _Validate for RPCs). It also has a full reference of UPROPERTY, UFUNCTION, UCLASS, USTRUCT and UENUM specifiers.
Summary
- One Edit/Visible specifier and one BlueprintRead specifier, plus a Category.
- EditDefaultsOnly for tuning values, VisibleAnywhere for components.
- Private + Blueprint access needs AllowPrivateAccess.
- Replicated needs GetLifetimeReplicatedProps and a replicating actor.
- Every UObject member pointer should be a UPROPERTY.
Frequently asked questions
What is the difference between EditAnywhere and EditDefaultsOnly?
EditAnywhere can be changed on the Blueprint class defaults and on every placed instance. EditDefaultsOnly can only be changed on the class defaults, so every instance shares the value unless code changes it.
Should component pointers use EditAnywhere or VisibleAnywhere?
VisibleAnywhere. The pointer itself should not be replaced in the Details panel, but the component's own properties stay editable when it is shown as Visible.
Do I need UPROPERTY on every UObject pointer?
On member pointers to UObjects, yes, unless you manage their lifetime another way. UPROPERTY (or a TObjectPtr member with UPROPERTY) lets the garbage collector see the reference, so the object is not destroyed while you still point to it.
Can I use BlueprintReadWrite on a private variable?
Only with meta = (AllowPrivateAccess = "true"). Without it, Unreal Header Tool reports an error because Blueprints cannot access private members by default.