Hey guys,
I’m unable to actually get the data back from my .sav file I’m testing. The data I’m writing to it probably cannot be serialized and I was wondering if that was something that can be helped without writing my own save file system.
My header file looks like this:
/**
*
*/
//Lets forward declare our Level Editor Data holder
class ULEData;
//Fdec Actor to use
struct FdataToReturn;
USTRUCT(blueprintable)
struct FDataStruct {
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, Category = "Saved Data")
TArray<FdataToReturn> dataToWrite;
};
UCLASS(Blueprintable)
class UILETEST_API UTestSaveGame : public USaveGame
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Basic)
FString PlayerName;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Basic)
FString SaveSlotName;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Basic)
int32 UserIndex;
//lets us set the data for the level
UFUNCTION(BlueprintCallable, Category = EnterData)
void setOurLEData(ULEData* incData);
//lets us get it back
UFUNCTION(BlueprintCallable, Category = EnterData)
TArray<FdataToReturn> getLEData();
//constructor
UTestSaveGame();
//UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Basic)
FDataStruct dataToSave;
};
my cpp looks like this:
#include "UILETest.h"
#include "LEData.h"
#include "TestSaveGame.h"
UTestSaveGame::UTestSaveGame()
{
//Do nothing for now
SaveSlotName = TEXT("TestSaveSlot");
UserIndex = 0;
}
void UTestSaveGame::setOurLEData(ULEData* incData) {
ULEData* tempStore = incData;
dataToSave.dataToWrite = tempStore->SDataArray;
}
TArray<FdataToReturn> UTestSaveGame::getLEData()
{
if (dataToSave.dataToWrite.Num() > 0)
{
//return our array
return dataToSave.dataToWrite;
}
else
{
//basically return nothing
return TArray<FdataToReturn>();
}
}
I then in blueprint call this, store my data points of ULEData and save the slot
but when I load the slot (even though it’s valid.) my struct is empty and the data inside it is empty…
I figure this is not getting written to the file. Any advice to what I’m missing?
Thanks