Override components

Hey everyone

I have some weird idea to be able to replace any class like PrimitiveComponent with a class that inherits from it like staticMeshComponent on the fly without having to create a new component or write code

for example I want to have character with box collider
and then I decided to make another character but with sphere collider
nothing else is changed

it would be nice if we could replace the box with sphere and it works just fine

so I tried to make something similar to that by creating a UPrimitiveComponent property and making it editable anywhere
and I got this


note : generate collider is just the name of the property nothing super fancy :slight_smile:

it didn’t require any constructor code to work
but I noticed that it gets crazy if there is no root component

what happens when I assign a class to it is it creates the selected class as a new component then assign it to the root component
and if I reassign it again it would create another component with the original still being alive and also the new one will be attached to the root component

any suggestions about this kind of workflow ?
and how I could customize it to be able to just replace without creating a new one ?