At some point in your project, you might need to create a new custom Asset class, for example, an Asset to store conversation data in an RPG.
In order to properly integrate these with Content Browser, you'll need to create a new Asset type.
Create a custom Asset based on
UObject
:#pragma once #include "Object.h" #include "MyCustomAsset.generated.h" /** * */ UCLASS() class UE4COOKBOOK_API UMyCustomAsset : public UObject { GENERATED_BODY() public: UPROPERTY(EditAnywhere, Category = "Custom Asset") FString Name; };
Create a class called
UCustomAssetFactory
based onUFactory
, overridingFactoryCreateNew
:#pragma once #include "Factories/Factory.h" #include "CustomAssetFactory.generated.h" /** * */ UCLASS() class UE4COOKBOOK_API UCustomAssetFactory : public UFactory { GENERATED_BODY() public: UCustomAssetFactory(); virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context...