Hey. I’m currently doing some research into custom assets and editors in UE4 and I’ve been stopped at the very beginning of my path there. As there’s very little up-to-date documentation/tutorials online, I’m hoping someone here can help me. Basically I’ve created the asset class inheriting from UObject, I’ve created factory for it, setup seems very similar to other, built-in asset types, but my class doesn’t appear in Context Menu under Misccellaneous, as it should, from what the tutorial I’m following states. I even tried copying the exact code from the tutorial to no effect neither… Following are my code files:
MyCustomAsset.h:
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "MyCustomAsset.generated.h"
/**
*
*/
UCLASS(BlueprintType, hidecategories = (Object))
class QUESTSYSTEM_API UMyCustomAsset : public UObject
{
GENERATED_BODY()
protected:
UPROPERTY(VisibleAnywhere, Category = MyCustomAsset)
FString Description;
UPROPERTY(VisibleAnywhere, Category = MyCustomAsset)
bool bIsActive;
};
It has nothing in its .cpp.
MyCustomAssetFactory.h:
#pragma once
#include "CoreMinimal.h"
#include "Factories/Factory.h"
#include "MyCustomAssetFactory.generated.h"
/**
*
*/
UCLASS()
class QUESTSYSTEM_API UMyCustomAssetFactory : public UFactory
{
GENERATED_BODY()
public:
UMyCustomAssetFactory(const FObjectInitializer& ObjectInitializer);
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext) override;
bool ShouldShowInNewMenu() const override;
};
MyCustomAssetFactory.cpp:
#include "MyCustomAssetFactory.h"
#include "MyCustomAsset.h"
UMyCustomAssetFactory::UMyCustomAssetFactory(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
SupportedClass = UMyCustomAsset::StaticClass();
bCreateNew = true;
bEditAfterNew = true;
}
UObject* UMyCustomAssetFactory::FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext)
{
UMyCustomAsset* MyCustomAsset = NewObject<UMyCustomAsset>(InParent, InClass, InName, Flags);
return MyCustomAsset;
}
bool UMyCustomAssetFactory::ShouldShowInNewMenu() const
{
return true;
}
Does anyone have any idea why it doesn’t show up?