Toggling bool flags in Inspector resets FBodyInstance

New bug/feature of 4.12, when you play in editor, eject and select your actor, than toggle any bool flag in inspector actors body got reset. It’s mass is reset. Simply it is reconstructed as a new object, and I am not sure if other components are reconstructed too. Looks strange, because why need to reconstruct already constructed object?

It rewirtes or preconfigured object data. Even data changed in inspector is overwritten.

https://i.gyazo.com/7e0a82edb2f4a6a1bd082a3cd70bfb0e.png

Actually the same behaviour is in UE 4.11. Strange never noticed it before.

I managed to fix this issue with resetuping the physics asset of the actor, still don’t know how center of mass is calculated.

You mentioned physics asset. Are you seeing this behavior with a Skeletal Mesh?

But yes, changing any of the bools under the Details panel during runtime will cause the mesh to be reinitialized. So seeing a jump in the physics (or reset) is normal.

As far as calculating the Center of Mass, what specifics are you looking for? When not in PIE, you can see a green sphere visualizer in the Editor Viewport that shows exactly where the center of mass is located.

Yep, this behavior noticed for skeletal mesh. For center of mass - i have not checked if it is reset with the component.
Actually this behavior is not a problem for a packed project, but in editor it makes some troubles while debugging. Is there any function which can handle that event and reinitialize component? also interesting if such behavior can be expected for some other components.

Yeah, it’s literally just re-initializing the entire blueprint. You can test this be adding a print string to the Construction Script. It will fire every time one of the bools is toggled.

You could probably dig into the constructor and find exactly what is triggering it, but I don’t recommend making to many changes there.

Hm, rerunning constructors on already created actors looks a little bit strange, why anybody need this. What about current state of the actor variables? If my actor is in the middle of executing some sequence, than just checking some debug bools will completely reset it?

PIE is for testing and quick iteration. It’s expected to see the results of any setting that is toggled in real-time. It’s intended functionality.

If the actor was in the middle of a sequence when a setting was toggled, then it would be reconstructed and the sequence would begin again with the new setting.

Yep, I understand, but that makes no sense to me, if i’d want to restart sequence, i’ll add some button to restart it manually, but if i don’t want to I have no option now. And I see no logic in reconstructing the object after switching some flag, completely unexpected behavior.

On the other hand, If i’d be using constructor scripts, and if creating some child actors in them, now i need to make sure the old one are deleted somehow. While in final version of game i don;t need to care about this, because all objects are created a new.

Maybe there is the reason for reconstructing objects, but for now it sounds like only adding problems.

On the other side this behavior can be useful for only blueprint coding and prototyping, when users are creating objects according to editor object setup.

But still there are some fields which are completely runtime, and checking “what happen if this field will have that value now” is also part of “testing and quick iteration”