Recently I have started to move from BP to C++ in UE4.
Before, I modified the BoxCollision’s Extend property by assigning to a Vector variable OutOfBoundBoxScale. It was easily editable in Details panel. See the pic below for BP
Now I want similar functionality in C++ too. But I dont know how to assign my BoxCollision’s Extend attribute to my custom Vector variable.
Hello! The thing is CPP Constructor is called before BP Constructor, so when CPP code execute 4th line in you code sample OutOfBoundBoxScale has only default value. And only after that BP set it to some value.
What @Kehel18 said is correct. To solve this you could override the editor only function void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent); and call BoxCollision->SetBoxExtent(OutOfBoundBoxScale); from there when you edit the vector, that has a somewhat similar effect to using the construction script. The question is why you would want to do any of that? The box collision component already has an extent property that you can modify directly.