Download

How to replace a class with a subclass? Or add new, editable components through C++?

I created a new subclass of Static Mesh Component because I wanted to turn off shadows and other changes by default. I have a bunch of existing objects that have normal mesh components I want to replace with the new one. Is there a way to do that in C++?

I have a function that would ideally update the meshes in the object, but it doesn’t work. I’ve tried just recreating the components in C++, but that just creates an inherited version of that component that doesn’t allow for any edits, has nothing in Details when I click on it, and I can’t see it in the viewport. Also, when I close Unreal and open it back up, it doesn’t exist anymore. So yeah, I think I’m going about this the wrong way.

Here’s a list of things I’ve tried (and led to the problem described above). I’m aware some of the stuff there might just be fluff or unnecessary, but I’ve just been exhausting my options. Ignore the red underlines

I think that if there was a way to just replace the class, that would be ideal, and idk maybe Unreal has something that regular C++ can’t do. I’m hoping it does. Probably doesn’t. But the alternative is recreating the components that I made in Blueprints through C++ that still has the same functionality as if I made them in Blueprints (ie not inherited and won’t disappear when I close Unreal)

EDIT: There is something about an Asset Registry? Is that something I can use instead?