I’m trying to save a list of items that contains information like transform and if they should be spawned.
Because an actor will check it’s saved state when it’s spawned i want to use a TMap for faster lookups.
But the TMap isn’t saved while other properties are saved.
This is my USaveGame:
USTRUCT()
struct FEnemySave{
GENERATED_USTRUCT_BODY()
UPROPERTY()
FName Id;
UPROPERTY()
bool Death;
};
USTRUCT()
struct FPlayerSave{
GENERATED_USTRUCT_BODY()
UPROPERTY()
int8 Level;
UPROPERTY()
FVector Position;
UPROPERTY()
FRotator Rotation;
};
USTRUCT()
struct FSave{
GENERATED_USTRUCT_BODY()
UPROPERTY()
FString PlayerName;
//UPROPERTY()
TMap<FName, FEnemySave> Enemies;
UPROPERTY()
FPlayerSave Player;
};
/**
*
*/
UCLASS()
class MOONSHINEWORKS_API UMOOSaveGame : public USaveGame
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(VisibleAnywhere, Category = MOO)
FSave Data;
};
I noticed that when i don’t set the UPROPERTY on a value it stops saving corretly but i can’t use tge UPROPERTY for the TMap.
Edit: Removed a stupid comment from code.