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.
This seems to be a bug since 5.2 and still exists in 5.3.2. I am following a tutorial about UE editor tool programming and many comments complain about this bug. The usable way to show c++ function of UAssetActionUtility derived class with CallInEditor in right-click menu correctly, is to create a child blueprint class asset from your UAssetActionUtility derived class (in this article is UMyAssetAction) and put it in any Content folder. Any time you add a new CallInEditor function in this C++ class, you will have to go to that blueprint asset click compile and save, unless new written functions may not show up correctly.
I haven’t find a more elegant way to just skip the manual action above or do that by code. If anyone knows how to do it, plz leave comment. Very grateful to that.