EditAnywhere vs VisibleAnywhere

You want to write a C++ class and edit some variables in a Blueprint of that class. But now, you don’t know which one of these you should use?

UPROPERTY(EditAnywhere)
USceneComponent* ExampleComponent;

or

UPROPERTY(VisibleAnywhere)
USceneComponent* ExampleComponent;

Then read the answer.

1 Like

The specifier name can be quite confusing, because if you want to change variables on your C++ class or BP, you would guess to mark them editable and not visible.

However, with Components (or UObjects in general), the specifier is basically marking the pointer to the UObjects as visible. This means, you don’t declare the UObjects itself to be visible only, that’s why you can still edit the values of your UObjects. Don’t forget that all the variables of your UObjects are defined in the UObject already and if some variables show up in your new class, it’s because they are defined to show up in your UObject.

This is also true for all other visible modifiers (VisibleAnywhere, VisibleDefaultsOnly, VisibleInstanceOnly). I also recommend watching this guy’s explanation on them.

tldr; Use Edit modifiers on your simple datatypes (bool, float, int32 etc.) and use Visible modifiers for any UObject pointer.

*thanks LethalClips on Discord for showing the difference! <3

2 Likes

The youtube link is groundbraking!