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"

UPROPERTY values within Component lost after new c++ compilation

Hi,

I can set references of other components in the editor as values of components, but when I modify the C++ code this changes get lost.

For instance:

 class MY_API USwitchComponent : public UActorComponent
 {
     GENERATED_BODY()
 public:
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = SwitchComponent)
     USwitchableComponent* SwitchableComponent;
 ...
 }
 
 
 UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
 class MY_API USwitchableComponent : public UActorComponent
 {
     GENERATED_BODY()    
 public:
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Disturber)
     TArray<USwitchComponent*> SwitchComponents;
 }

I guess that the editor checks that there's a new version of the component or actor, replaces them with the new version and tries to sets the values of the old version with the new version. Only happens when I change either the component itself or the actor that owns that component. It might fail since it's a component referencing another component, but it works until I modify code of the owner actor or the components.

How can I solve this? Is there a walkaround? Does anybody know the exact piece of code where the editor does this?

Thanks, FL

Product Version: UE 4.18
Tags:
more ▼

asked Jan 17 '18 at 10:04 AM in C++ Programming

avatar image

Bionic Ape
129 16 20 25

avatar image BrUnO XaVIeR Jan 17 '18 at 11:32 AM

Are you using hot reload? Hot reload discards old DLLs and generate then link to new ones.

avatar image Bionic Ape Jan 17 '18 at 02:11 PM

Yes, you were right it's the Hot Reload! Thanks!!

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

1 answer: sort voted first

Hey there, that might be a known bug that you have in 4.18. If you have a variable defined in c++ and you set it's value in blueprints on a child class, when you hot reload it reverts back to the original value from c++, which is usually empty. Hopefully that will be fixed in 4.19. Right now the only workaround is to restart the engine after making a change in the c++ header.

more ▼

answered Jan 17 '18 at 11:49 AM

avatar image

xlar8or
6k 163 129 305

avatar image Bionic Ape Jan 17 '18 at 12:30 PM

It might be related, but I don't use blueprints, it's pure C++, Actors and Components.

avatar image Bionic Ape Jan 17 '18 at 02:08 PM

Thanks it's the hotreload.

The funny thing is that the actors and components were pure C++, no blueprints involved.

avatar image xlar8or Jan 17 '18 at 02:18 PM

Hopefully epic will fix this in 4.19 :)

avatar image Nevey Jun 02 '18 at 10:44 PM

Doesn't seem fixed in 4.19

(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