I am having some issues with the UAssetActionUtility class. Creating a subclass in editor has no issues and everything works as expected. However I am trying to create a subclass purely within C++ and am clearly missing something as the function name does not show up in the context menu for the asset.
.h file
UCLASS()
class UMyAssetAction : public UAssetActionUtility
{
GENERATED_BODY()
public:
UMyAssetAction();
UFUNCTION(CallInEditor)
void Generate();
};
The “Generate” function won’t appear in editor however if I just create an empty BP inheriting from UMyAssetAction then Generate immediately starts working.
I assume I need to register something in the Editor Module but I am just not sure what.
Override the GetSupportedClass function and return the class of your asset in it.
If your asset is a blueprint then you need to use UBlueprint::StaticClass(), but in this case, you will see your function on all blueprints, since the ASSET type is a blueprint.
You cannot specify an asset class that is edited via blueprint as the type.
I missed that last part where you said you needed to create an empty Blueprint inheriting from your class. I believe that is what you’re supposed to do.
Yeah it just seems so weird and wasteful when my code is doing all the work and I basically have to make an empty shell blueprint just so that work can be executed.
Yeah the assets do exist in the editor so I can right click them and perform asset actions on them. The problem is that my asset action utility class which I wrote in C++ doesn’t have its functions show up in the context menu unless I create a blueprint child of my asset action utility first.
It just seems so weird that I can’t register my utility class somewhere in code to have it appear in the asset context menu whilst just making an empty blueprint that inherits from it immediately works.