I am fairly new to Unreal and C++ and tried to add a new asset type of which I can create instances in the editor in the right-click menu in the content drawer. I was following this guide, but with an own class instead of a variation of StaticMesh:
My asset class looks like this:
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CustomDataAsset.generated.h"
UCLASS()
class DATAASSETTEST_API UCustomDataAsset : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
float MyFloat;
};
Been a while since I did this but I think you need an FAssetTypeActions implementation for your type, which ties this stuff together. You register the actions type at module startup and unregister at shutdown. E.g. we’ve got a custom blueprint type with an asset actions that inherits FAssetTypeActions_Blueprint and is registered/unregistered in our editor module. You might just want to inherit FAssetTypeActions_Base, have a look at AssetTypeActions_DataAsset.h for what you might want to override. Importantly there’s the GetCategories() function that you override to specify the category for your type in the menu.
As an aside, if all you want is a generic data asset, you can just inherit UDataAsset and forget all this other stuff. You’ll be able to create it without any additional work. If you want to customize the category you can still add your own asset type actions override to do that.
I was a bit confused about how to create a DataAsset before. I didn’t know that I have to write a base class for own DataAssets to let the DataAsset created in the editor menu inherit from. But since I understood that now, the generic DataAsset really is all I need. Thanks for pointing it out
i created the asset action class inherits from the action base class and set the color and everything , in the factory create new i used newobject and it makes the new asset with the same info from the asset type i made , but when i open the asset it opens like data asset and i dont have a bp editor and this is a UObject , but creating the same object from the create new blueprint wizard i get the object but it seams like using the asset action_blueprint type and not mine , and i edited the create new in the factory and used create new blueprint instead of new object and it dose the same as creating the objecct from the wizard, so i am asking about how to make the custom uobject asset that is created from the right click menu with my custom asset type and also have the bp editor opens when i double click the asset and not be treated as a data asset , i have an idea that the issue is i use FSimpleEditor::Create editor in the open asset override, but i dont know how to make it to open BP editor , hope my issue is clear and thanks for reading all this