How do you configure UProperty data on classes that derive from UUserWidget?

EditDefaultsOnly is only visible in class defaults, so if you want it to show in widget editor when you place a widget you need ot use EditAnywhere or EditInstanceOnly instead, as in widget editor those are instances of your widget class not defaults

How do you configure UProperty data on classes that derive from UUserWidget?

As an example,

UCLASS()
class UUMGBaseWidget : public UUserWidget
{
	GENERATED_BODY()
	
public:

protected:
    UPROPERTY(EditDefaultsOnly)
    int32 MyProperty;
};

MyProperty doesn’t show up anywhere in the UMG Editor. I’ve tried this with numerous other data types and nothing has worked. The only thing that I have seen that’s worked is binding widgets. TSubclassOf doesn’t work either.

For more context, I need to create 40 instances of a derived UUserWidget programmatically (as I don’t want to drag and drop 40 of them in the UMG editor), so I was hoping to use TSubclassOf<> and other UProperty data to do so.

I think you might wanna add “BlueprintReadOnly” or “BlueprintReadWrite” to your UPROPERTY there.

EditDefaultsOnly won’t let you use the variable in the Graph, only to edit it’s default value on the class defaults panel.

263127-0.png

EDO_Int only shows in the Details panel but can’t be accessed in the blueprints graph.

263128-1.png

BRW_Int shows in the blueprint graph and not in the details panel.

263129-2.png

If you need it to show on both places just use both

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int32 MyInt;

so it shows in both places.


here’s a breakdown of the main UPROPERTY parameters:

1) These let the blueprint graph access the variable

  • BlueprintReadOnly: Blueprint can only “get”
  • BlueprintReadWrite: Blueprint can “get” and “set”

2) These display the variable on the details panel

  • VisibleAnywhere: Can be seen in details panel anywhere
  • EditAnywhere: Can be edited in details panel anywhere
  • EditDefaultsOnly: Can only be edited in Blueprint details panel
  • EditInstanceOnly: Can only be edited in Editor details panel

Thanks, that was the issue. I completely forgot about EditAnywhere.