Custom assets don’t appear in the “Add New” or “Right Click” menu.
Any existing custom assets still function as expected and can be duplicated.
I tested and implemented the code in version 4.23 and it was working. I then upgrade the project to 4.25 and the asset was no longer appearing in the menus.
Code:
// MyCustomAsset.h
UCLASS()
class PROTOTYPES_API UMyCustomAsset : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
float MyValue;
};
// MyCustomAssetFactoryNew.h
UCLASS()
class PROTOTYPES_API UMyCustomAssetFactoryNew : public UFactory
{
GENERATED_BODY()
public:
UMyCustomAssetFactoryNew();
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};
// MyCustomAssetFactoryNew.cpp
#include "MyCustomAssetFactoryNew.h"
#include "MyCustomAsset.h"
UMyCustomAssetFactoryNew::UMyCustomAssetFactoryNew()
{
bCreateNew = true;
bEditAfterNew = true;
SupportedClass = UMyCustomAsset::StaticClass();
}
UObject* UMyCustomAssetFactoryNew::FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
return NewObject<UMyCustomAsset>(InParent, InClass, InName, Flags);
}