In 5.1.1, when building for Windows, I get errors for each property in a struct, like this:
`Error: IntProperty FCharacterStats::SilverMedals is not initialized properly. Module:LANDNAV File:SaveGame_base_ln.h`
NOTE that I get that error for every property in the struct.
The header file defining this struct looks like this (I have snipped out most properties for legibility here, indicated with …):
USTRUCT(BlueprintType)
struct FCharacterStats
{
GENERATED_BODY()
//constructor
FCharacterStats()
{
Archetype = "None";
EventsCompleted = 0;
DiamondMedals = 0;
GoldMedals = 0;
SilverMedals = 0;
BronzeMedals = 0;
TotalDistanceTraveled = 0;
TotalDistanceWalked = 0;
TotalDistanceSkied = 0;
TotalDistanceBiked = 0;
TotalDistanceKayaked = 0;
TotalDistanceClimbed = 0;
TimesExhausted = 0;
TimesInjured = 0;
}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int EventsCompleted;
.....
UPROPERTY(BlueprintReadWrite, EditAnywhere)
double TotalDistanceTraveled;
....
};
This struct is used in a save game class and I set the default values in a blueprint child of this c++ class. Save and load works normally in PIE.
Blueprint child setting the default values:
I added the constructor because I have read that perhaps the properties need to be explicitly initialized, however it does not seem to change the errors I get when building.
I am not super experienced with C++ so it’s most likely that I’ve just missed something basic. Any tips are appreciated.
additional:
Here is where the struct is added to the save game class. I have not done anything in a .cpp file.
UCLASS(Blueprintable)
class LANDNAV_API USaveGame_base_ln : public USaveGame
{
GENERATED_BODY()
public:
//STRUCTS
// characters are in order of A, B, C, D, E, F, G, H
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= "Characters")
TArray<FCharacterSkills> CharacterSkills;
// characters are in order of A, B, C, D, E, F, G, H
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category= "Characters")
TArray<FCharacterStats> CharacterStats;