x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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.

Product Version: UE 4.20
Tags:
more ▼

asked Dec 22 '18 at 10:55 PM in C++ Programming

avatar image

Artemis_
45 2 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

more ▼

answered Dec 22 '18 at 11:43 PM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image Artemis_ Dec 28 '18 at 08:16 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

alt text

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

alt text

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

alt text

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

0.png (4.7 kB)
1.png (3.0 kB)
2.png (19.0 kB)
more ▼

answered Dec 22 '18 at 11:40 PM

avatar image

Evigmae
1.7k 8 4 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question