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"

[C++] Actor Component variables Reset when restarting Editor

[C++]

Hi! I have an issue where my Actor Component that i made in c++ gets its variables reset to their default values when the component is implemented into a actor BP and i restart the editor.

As you can see in the pic, the bools on the right are at their default values which set in the .h, if i where to change them in the BP, close the editor and start it back up, they would be back to their default values again.

How can i make changes that i make to the actor component permanent and get saved?

Thanks!!

alt text

Product Version: UE 4.21
Tags:
capture.jpg (186.6 kB)
more ▼

asked May 22 '19 at 12:03 AM in C++ Programming

avatar image

nameLive
18 3 4 8

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

3 answers: sort voted first

Ok figured it out. It happens when i add a Event Dispatch Delegate with:

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FManualLerp);

Then in the class .h:

 UPROPERTY(BlueprintAssignable, Category = "TimeManipulation")
     FManualLerp ManualLerp;


After adding a delegate, it won't save unless i delete and re-add the component in the list, then it works as intended. So after every delegate changed/added you have to re-add the comopnent in the list.

more ▼

answered May 22 '19 at 07:40 AM

avatar image

nameLive
18 3 4 8

avatar image Chkoupinator May 22 '19 at 02:25 PM

Did you read my answer? I'm pretty sure this has something to do with hot reload

avatar image nameLive May 22 '19 at 02:44 PM

oh yes your right, i tried it again (4.22) this time and when adding the delegate, closing down the editor, rebuilding from visual studio then starting the editor up and then it worked as intended.

So to summize, when adding/changing event dispatch delegates for actor components, close the editor down and compile in VS, then start it up. If Compiling with editor up (Hot Reload) then you have to delete the actor component from the BP and re add it which causes you to lose any settings you've made to it

avatar image Chkoupinator May 22 '19 at 02:48 PM

It's not only about delegates though, pretty much anything that interfaces with blueprint like UProperties UFunctions (and delegates/events) will break some stuff/corrupt your blueprint if you use hot reload

avatar image nameLive May 22 '19 at 04:30 PM

Usually works fine for me if for example i have a BP that is derived off of a cpp class and change something in the .h, hot reload, the BPs would work as intended.

But i've seen alot of other posts about it so it seems to be something Epic should really prioritize.

Thanks anyway for all the help! :)

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

This is sadly a common issue with hotreload and could even affect your game in ways that would make it crash, I used to experience some very strange bugs because of it too (by having static mesh subclasses loose their blueprint selected meshes)

What I suggest you is one of the following:

  • Close the project then rebuild your whole project from visual studio and launch it. Every time you want to make a change to the C++ especially to the header files (and especially for UPROPERTIES) I suggest you close the Editor and recompile it from Visual Studio.
    • Optionally even delete the intermediate folder, the binaries folder and the .sln file and recreate it by right clicking on the .uproject file and selecting generate visual studio file

  • Delete the current actor that you made and make a new one exactly similar but avoid using hot reload when modifying it.

  • Add a bunch of nodes to the construction script of your blueprint to initialize the variables to what you would have set.

  • Optionally: Upgrade your project to 4.22 and enable Live++ from the project settings, search for Live Coding (if you have issues while trying to enable it, check this out.

I really hope some of these strange hot reload issues get fixed...

more ▼

answered May 22 '19 at 03:45 AM

avatar image

Chkoupinator
132 1 5 4

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

The strange thing is the engine doesnt even inquire me to save after a made any change to the actor comopnents values, like it doesnt even count it as a part of the BP.

Is there anything basic you have to do for it to "register" as a comp?

Yea having nodes in the constructino script would fix it if have BP variables, but i would like the component to be able to be places on static mesh actors that is not a BP and work as well, with no other code required for it to work.

more ▼

answered May 22 '19 at 07:16 AM

avatar image

nameLive
18 3 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