Manual call to construction script

Hello,

I cant seem to figure out how to manually call the construction script that is called whenever you drag an actor. I’m looking at how to do this through C++. Basically lets say there is an ‘Attack power’ variable, and a ‘Strength’ variable. Currently if you alter the strength variable through the details panel of the character, construction script runs and changes the attack power accordingly, however this construction script won’t run if the strength variable is altered through a custom-made widget (The strength variable will change, but attack power will only update until I drag the character)

If I understand this right, you are using the widget during runtime and then want your actor to be “reconstructed”. This is not a good approach, and doesn’t make much sense in the context of c++. Constructors should be only called when an actor is created. If you want to change the value of a variable in runtime you need to change the value of the variable inside a function, not by using your constructor.

You need to do a separate function for the widget that calculates the new attack power or strength whenever any of these are changed. So you have a function OnStrengthChanged and it updates the value of attack power as well.

Sorry I must’ve been unclear. All of this is editor only, 0 run time involved. In the editor, changing something through details panel runs a construction script, changing something through a custom made widget will not. I’m wondering if there is a way to manually run this construction script

also curious about this

[This method was what worked for me][1]

Example of implementation is shown below, the #if WITH_EDITOR define makes sure this code isn’t present in the final build of your project.

Actually having re-read my question (from a couple years ago!) I am not sure if I ever resolved that construction script fiasco specifically, but rather I believe I found a different way to do what I wanted to do using PostEditChangeProperty