Change Default Actor Class used for Drag and Drop of Assets

I would like to override the default class used for drag and drop in the editor for Static Meshes.

Right now when you drag and drop a Static Mesh asset into the scene it will create a StaticMeshActor using that static mesh asset.

I want to use a C++ Class which inherits from StaticMeshActor, let’s call it MyStaticMeshActor and make MyStaticMeshActor the default class for Static Mesh assets that are added to the scene using drag and drop operations.

As it is now, I have to add MyStaticMeshActor to the scene and select the static mesh I wish to use from the properties, this also has the disadvantage of having the default name being MyStaticMeshActor#, which makes for more work in renaming each actor used.

Any help would be greatly appreciated!

This was resolved on the forum: Change Default Actor Class used for Drag and Drop of Assets - C++ - Epic Developer Community Forums

This cannot be found anymore.

It can be found in the wayback machine Change Default Actor Class used for Drag and Drop of Assets - Unreal Engine Forums

Quoting just in case:

You should just be able to create your own UActorFactory-derived class (inside an editor module) and give it a higher priority than the default static mesh one has.

Thank you I did not know that!
What I just ended up doing was creating a Toolbar Button Plugin and adding this into PluginButtonClicked()

Code:

TSet ComponentsToConsider;
ComponentsToConsider.Add("StaticMeshComponent");
TArray SelectedActors;
GEditor->GetSelectedActors()->GetSelectedObjects(SelectedActors);
UClass* ReplaceWithClass = AInheritedStaticMeshActor::StaticClass();
GEditor->ConvertActors(SelectedActors, ReplaceWithClass, ComponentsToConsider, true);

I was completely unaware that UActorFactory Classes could override each other, I’ll have to look into that.