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"

EditInline TSubobjectPtr does not save properties changed in editor

I am trying to make values of a TSubobjectPtr changable in the editor, which works, but whenever I restart the editor the changes have reset.

My structure is basically this:

 UCLASS()
 class UActionObject : public UObject
 {
     GENERATED_UCLASS_BODY()
 
     
     UPROPERTY(EditInline, VisibleAnywhere, BlueprintReadOnly, Category = Configuration)
     TSubobjectPtr<UActionConfig> ConfigForXY;
 
     UPROPERTY(EditInline, VisibleAnywhere, BlueprintReadOnly, Category = Configuration)
     TSubobjectPtr<UActionConfig> ConfigForAB;
     
 }
 
 UActionObject::UActionObject(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     ConfigForXY = PCIP.CreateDefaultSubobject<UActionConfig>(this, "Config 1");
     ConfigForAB = PCIP.CreateDefaultSubobject<UActionConfig>(this, "Config 2");
 }

and

 UCLASS()
 class UActionConfig : public UObject
 {
     GENERATED_UCLASS_BODY()
 
     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Configuration)
     int32 numberTest;
 
     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Configuration)
     bool bToggleTest;
 }
 
 UActionConfig::UActionConfig(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     numberTest = 42;
     bToggleTest = false;
 }

I can save extended blueprint assets and use them in PIE correctly, but once I restart the Editor all UActionConfig values are back to false and 42.

Am I doing something wrong or is this a bug?

greetings FTC

Product Version: Not Selected
Tags:
more ▼

asked Jun 24 '14 at 07:18 PM in C++ Programming

avatar image

FTC
171 6 12 15

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

1 answer: sort voted first

The subobject name you pass to PCIP.CreateDefaultSubobject needs to match the actual property name. Otherwise, it won't recognize that the default has been overridden.

So you need to change "Config 1" to "ConfigXY", and similarly for "Config 2".

more ▼

answered Jan 19 '15 at 04:47 PM

avatar image

Sneftel
480 21 21 40

avatar image FTC Jan 29 '15 at 02:30 PM

From my tests that didn't matter whether or not the name matched the variable or not. It is true that changing the name would drop data saved prior to doing it.

However since then I switched to 4.6 and now use regular pointers and the Instanced specifier which solved the problem.

(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