Trying to make a blueprint from a C++ class that can have different shape components as the root component. Say i want some blueprints subclassed from this to have BoxComponents, and some to have CapsuleComponents.
Seems like it should be easy.
What happens instead is that when while there is a widget in blueprint editor to change this shape to whatever i want, it simply doesn’t affect anything. The original shape still persists. what am i missing?
I know this is an old post, but i also want to know how to achieve that.
I tried removing the old component and adding a new one in the PostEditChangeProperty method, but the editor just crashes…
I am also having this same issue as of 4.20.1; it seems there is a little bit of a workaround by using PostEditChangeProperty as done in that forum post to change the collider class at runtime and making the collider the root component every time a specified shape property changes, but this is still really messy, and it’s proven incredibly cumbursome and not very robust. Is there a good reason that we can’t use polymorphism and hold a default UShapeComponent* to some arbitrary UShapeComponent type and then swap other UShapeComponent types on a per class basis?.