This is the tutorial I followed
Hey so I’m trying to replicate what’s done in this tutorial in C++ only but I keep getting these errors when trying to use the getter function does any one know way
Code of primary asset
.h
UENUM(BlueprintType)
enum class EDataTable : uint8 {
None,
DT_1,
DT_2,
DT_3
};
UCLASS()
class UNREALCOC_API UTestPrimaryDataAsset : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = "DataTables")
TMap<EDataTable, TSoftObjectPtr<UDataTable>> AvailableDataTables;
protected:
UPROPERTY(EditAnywhere, Category = "Async Helper Data")
TArray<EDataTable> DataTablesToFind;
#pragma region FUNCTIONS
UFUNCTION(BlueprintCallable, Category = "Data Async Load Helper")
void RequestAsyncLoad_DT(const UObject* DataOwner);
UFUNCTION(BlueprintCallable, Category = "Data Async Load Helper")
void UnloadAllObjects(const UObject* DataOwner);
UFUNCTION(BlueprintCallable, Category = "Data Async Getter")
TArray<UDataTable*> GetAvailableDataTables() const;
UFUNCTION()
void OnDataTableLoaded();
#pragma endregion
private:
TArray<UDataTable*> FoundDataTables;
TArray<FSoftObjectPath> ObjectsToUnload;
};
.cpp
TArray<UDataTable*> UTestPrimaryDataAsset::GetAvailableDataTables() const{
return FoundDataTables;
}
In DT_Ref
.h
class UNREALCOC_API UDT_Ref_Class : public UActorComponent
{
GENERATED_BODY()
public:
void TryLoad();
UTestPrimaryDataAsset* TAsset = LoadObject<UTestPrimaryDataAsset>(NULL, TEXT("/Game/PrimaryAssets/TestDataTables2/TestDT_Asset"), NULL, LOAD_None, NULL);
TArray<UDataTable*> Array;
}
.cpp
void UDT_Ref_Class::TryLoad(){
if(TAsset != nullptr){
//TAsset->execRequestAsyncLoad_DT(ContextO);
}
Array = TAsset->execGetAvailableDataTables();
}
when I do this I get these errors from my IDE
no operator “=” matches these operands
too few arguments in function call
i’ve also tried this
.cpp
void UDT_Ref_Class::TryLoad(){
if(TAsset != nullptr){
//TAsset->execRequestAsyncLoad_DT(ContextO);
}
TArray<UDataTable*>TestMe = TAsset->execGetAvailableDataTables();
}
when I do this I get these errors from my IDE
no suitable constructor exists to convert from “void” to “TArray<UDataTable*, FDefaultAllocator>”
too few arguments in function call
if any one can help with these errors it would be appreciated