Download

Create a StaticMeshActor that extends custom UObject

Is it possible to reparent a StaticMeshActor to a class that extends a custom version of either AActor or UObject.
I am 2 years into development and have blueprints that I would like to have a custom base class for, the problem being, they are of different types. One is a Static Mesh Actor, one is an Actor etc.
If I reparent the Static Mesh Actor to a custom Actor class, it understandably crashes the editor, but if I reparent to a custom Static Mesh Actor class it works fine.
So the idea being that I would create a custom AActor (MyBaseActor) that has base functionality, then extend my Static mesh actor and Actor classes from that.

You can make your custom base class inherit from AStaticMesh. You can always just ignore the static mesh component if you’re not using it. But that’s not the best option.

If what you’re looking for is to ensure actors have the right functions and properties I’d strongly suggest you look at interfaces instead. They’re a way for any class to say “I support everything that IMyGameObject needs.”

IMO static meshes aren’t enough of a reason to inherit from AStaticMesh because all it does is include a static mesh component by default.

Thanks for the reply. I’m using Interfaces already, but finding myself copying and pasting the functionality between blueprints. I had a function library for some things, but found it quite limiting for things like binding event dispatchers

That’s the cost of using them unfortunately. I just try to keep the code in them minimal if it’s always the same.