Hi I’ve been trying to create a custom asset type but no matter what I do I can’t get the custom asset to appear in misc category. I tried looking it up but none of the resources seem to work my code will be below. Any help would be appreciated.
I’m using UE4 version 4.27.2
JTable.h
UCLASS(BlueprintType)
class MYTABLELOADER_API UJTable : public UObject
{
GENERATED_BODY()
public:
//Get a entire row
/*UFUNCTION(BlueprintCallable)
FJTableRow& GetRow(FString RowName) { return Rows[RowName]; };
//Get a row's column as a FJTableValue
UFUNCTION(BlueprintCallable)
FJTableValue& GetRowColumn(FString RowName, FString ColumnName);
//Get a row's coulumn as a bool
UFUNCTION(BlueprintCallable)
bool GetBoolRowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
int32 GetInt32RowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
int64 GetInt64RowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
float GetFloatRowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
FString GetStringRowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
TArray<FJTableValue&> GetArrayRowColumn(FString RowName, FString ColumnName);
UFUNCTION(BlueprintCallable)
TMap<FString, FJTableValue&> GetMapRowColumn(FString RowName, FString ColumnName);
//Add row
UFUNCTION(BlueprintCallable)
void AddRow(FString RowName, FJTableRow& RowValue) {};
//Fill row by array
UFUNCTION(BlueprintCallable)
void FillRowByArray(FString RowName, TArray<FJTableValue&> RowValue) {};
//Fill row by map
UFUNCTION(BlueprintCallable)
void FillRowByMap(FString RowName, TMap<FString, FJTableValue&> RowValue) {};*/
//bool GetValueAsDouble();
//C++ Only functions
//--Get functions
bool TryGetRowAs(FString RowName, FString ColumnName, int32& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, int64& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, float& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, double& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, bool& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, FString& Val, int32 Dex = 0);
bool TryGetRowAs(FString RowName, FString ColumnName, int32& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, int64& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, float& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, double& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, bool& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, FString& Val, FString Dex);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<int32>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<int64>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<float>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<double>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<bool>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TArray<FString>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, int32>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, int64>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, float>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, double>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, bool>& Val);
bool TryGetRowAs(FString RowName, FString ColumnName, TMap<FString, FString>& Val);
//--Set functions
bool TrySetRowAs(FString RowName, FString ColumnName, int32& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, int64& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, float& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, double& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, bool& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, FString& Val, int32 Dex = 0);
bool TrySetRowAs(FString RowName, FString ColumnName, int32& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, int64& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, float& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, double& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, bool& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, FString& Val, FString Dex);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<int32>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<int64>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<float>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<double>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<bool>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TArray<FString>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, int32>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, int64>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, float>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, double>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, bool>& Val);
bool TrySetRowAs(FString RowName, FString ColumnName, TMap<FString, FString>& Val);
//--Special get functions
FJTableColumn* GetTableColumn(FString ColumnName);
void GetTableRow(FString RowName) {};
//--Misc function
void EmptyColumn(FString ColumnName);
void RemoveColumn(FString ColumnName);
//To work on
void RemoveRow(FString ColumnName) {};
//Blueprints Functions
UFUNCTION()
bool GetRowAsInt(FString RowName, FString ColumnName, int32& Val);
UFUNCTION()
bool GetRowAsfloat(FString RowName, FString ColumnName, float& Val);
UFUNCTION()
bool GetRowAsInt64(FString RowName, FString ColumnName, int64& Val);
UFUNCTION()
bool GetRowAsBool(FString RowName, FString ColumnName, bool& Val);
UFUNCTION()
bool GetRowAsString(FString RowName, FString ColumnName, FString& Val);
UFUNCTION()
bool GetRowAsIntArray(FString RowName, FString ColumnName, TArray<int32>& Val);
UFUNCTION()
bool GetRowAsInt64Array(FString RowName, FString ColumnName, TArray<int64>& Val);
UFUNCTION()
bool GetRowAsfloatArray(FString RowName, FString ColumnName, TArray<float>& Val);
UFUNCTION()
bool GetRowAsBoolArray(FString RowName, FString ColumnName, TArray<bool>& Val);
UFUNCTION()
bool GetRowAsStringArray(FString RowName, FString ColumnName, TArray<FString>& Val);
UFUNCTION()
bool IndexArrayAsInt(FString RowName, FString ColumnName, int32& Val, int32 Dex = 0);
UFUNCTION()
bool IndexArrayAsInt64(FString RowName, FString ColumnName, int64& Val, int32 Dex = 0);
UFUNCTION()
bool IndexArrayAsfloat(FString RowName, FString ColumnName, float& Val, int32 Dex = 0);
UFUNCTION()
bool IndexArrayAsBool(FString RowName, FString ColumnName, bool& Val, int32 Dex = 0);
UFUNCTION()
bool IndexArrayAsString(FString RowName, FString ColumnName, FString& Val, int32 Dex = 0);
UFUNCTION()
bool GetRowAsIntMap(FString RowName, FString ColumnName, TMap<FString, int32>& Val);
UFUNCTION()
bool GetRowAsInt64Map(FString RowName, FString ColumnName, TMap<FString, int64>& Val);
UFUNCTION()
bool GetRowAsfloatMap(FString RowName, FString ColumnName, TMap<FString, float>& Val);
UFUNCTION()
bool GetRowAsBoolMap(FString RowName, FString ColumnName, TMap<FString, bool>& Val);
UFUNCTION()
bool GetRowAsStringMap(FString RowName, FString ColumnName, TMap<FString, FString>& Val);
UFUNCTION()
bool IndexMapAsInt(FString RowName, FString ColumnName, int32& Val, FString Dex);
UFUNCTION()
bool IndexMapAsInt64(FString RowName, FString ColumnName, int64& Val, FString Dex);
UFUNCTION()
bool IndexMapAsfloat(FString RowName, FString ColumnName, float& Val, FString Dex);
UFUNCTION()
bool IndexMapAsBool(FString RowName, FString ColumnName, bool& Val, FString Dex);
UFUNCTION()
bool IndexMapAsString(FString RowName, FString ColumnName, FString& Val, FString Dex);
UFUNCTION()
bool SetRowAsInt(FString RowName, FString ColumnName, int32 Val);
UFUNCTION()
bool SetRowAsfloat(FString RowName, FString ColumnName, float Val);
UFUNCTION()
bool SetRowAsInt64(FString RowName, FString ColumnName, int64 Val);
UFUNCTION()
bool SetRowAsBool(FString RowName, FString ColumnName, bool Val);
UFUNCTION()
bool SetRowAsString(FString RowName, FString ColumnName, FString Val);
UFUNCTION()
bool SetRowAsIntArray(FString RowName, FString ColumnName, TArray<int32>Val);
UFUNCTION()
bool SetRowAsInt64Array(FString RowName, FString ColumnName, TArray<int64>Val);
UFUNCTION()
bool SetRowAsfloatArray(FString RowName, FString ColumnName, TArray<float>Val);
UFUNCTION()
bool SetRowAsBoolArray(FString RowName, FString ColumnName, TArray<bool>Val);
UFUNCTION()
bool SetRowAsStringArray(FString RowName, FString ColumnName, TArray<FString>Val);
UFUNCTION()
bool SetArrayAsInt(FString RowName, FString ColumnName, int32 Val, int32 Dex = 0);
UFUNCTION()
bool SetArrayAsInt64(FString RowName, FString ColumnName, int64 Val, int32 Dex = 0);
UFUNCTION()
bool SetArrayAsfloat(FString RowName, FString ColumnName, float Val, int32 Dex = 0);
UFUNCTION()
bool SetArrayAsBool(FString RowName, FString ColumnName, bool Val, int32 Dex = 0);
UFUNCTION()
bool SetArrayAsString(FString RowName, FString ColumnName, FString Val, int32 Dex = 0);
UFUNCTION()
bool SetRowAsIntMap(FString RowName, FString ColumnName, TMap<FString, int32>Val);
UFUNCTION()
bool SetRowAsInt64Map(FString RowName, FString ColumnName, TMap<FString, int64>Val);
UFUNCTION()
bool SetRowAsfloatMap(FString RowName, FString ColumnName, TMap<FString, float>Val);
UFUNCTION()
bool SetRowAsBoolMap(FString RowName, FString ColumnName, TMap<FString, bool>Val);
UFUNCTION()
bool SetRowAsStringMap(FString RowName, FString ColumnName, TMap<FString, FString>Val);
UFUNCTION()
bool SetMapAsInt(FString RowName, FString ColumnName, int32 Val, FString Dex);
UFUNCTION()
bool SetMapAsInt64(FString RowName, FString ColumnName, int32 Val, FString Dex);
UFUNCTION()
bool SetMapAsfloat(FString RowName, FString ColumnName, int32 Val, FString Dex);
UFUNCTION()
bool SetMapAsBool(FString RowName, FString ColumnName, int32 Val, FString Dex);
UFUNCTION()
bool SetMapAsString(FString RowName, FString ColumnName, int32 Val, FString Dex);
private:
//Hold the member data tables
UPROPERTY()
TArray<UDataTable*> TableMembers;
UPROPERTY(EditAnywhere, Category = "Notes")
FString TableNote;
UPROPERTY(EditAnywhere, Category = "Misc options")
bool IgnoreBlank = true;
//
//UPROPERTY()
//FJTableRow RowStruct;
TMap<FString, FJTableColumn*> Columns;
//Holds all the rows of the table
//TMap<FString, FJTableRow&> Rows;
//Hold only the imported rows
//TMap<FString, FJTableRow&> DefaultRows;
};
JTableFactoryNew.h
UCLASS()
class MYTABLELOADER_API UJTableFactoryNew : public UFactory
{
GENERATED_BODY()
public:
UJTableFactoryNew() {
SupportedClass = UJTable::StaticClass();
bCreateNew = true;
bEditAfterNew = true;
};/**/
//UJTableFactoryNew(const FObjectInitializer& ObjectInitializer);
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn);
virtual bool ShouldShowInNewMenu() const override;
//ShouldShowInNewMenu();
//virtual bool ShouldShowInNewMenu() const override;
};
class FJTableTypeActions : public FAssetTypeActions_Base {
public:
UClass* GetSupportedClass() const override;
FText GetName() const override;
FColor GetTypeColor() const override;
uint32 GetCategories() override;
};
JTableFactoryNew.cpp
UObject* UJTableFactoryNew::FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
//return NewObject<UJTable>(InParent, Class, Name, Flags, Context);
check(InClass->IsChildOf(UJTable::StaticClass()));
return NewObject<UJTable>(InParent, InClass, InName, Flags);
}
bool UJTableFactoryNew::ShouldShowInNewMenu() const
{
return true;
}
UClass* FJTableTypeActions::GetSupportedClass() const
{
return UJTable::StaticClass();
}
FText FJTableTypeActions::GetName() const
{
return INVTEXT("J Table");
//return NSLOCTEXT("AssetTypeActions", "AssetTypeActions_TextAsset", "Text Asset");
}
FColor FJTableTypeActions::GetTypeColor() const
{
return FColor::Cyan;
}
uint32 FJTableTypeActions::GetCategories()
{
return EAssetTypeCategories::Misc;
}