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?
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…
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.
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.
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
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
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.