Create a template project and add an Actor with a TArray of a custom struct. Everything declared with UPROPERTY so it can be serialized.
USTRUCT()
struct FMyStruct
{
GENERATED_BODY()
UPROPERTY()
bool bOneBool = true;
UPROPERTY()
bool bAnotherBool = true;
};
UCLASS()
class AMyActor : public AActor
{
GENERATED_BODY()
// ...
UPROPERTY()
TArray<FMyStruct> TheArray;
};
sizeof(FMyStruct)
gives 2. If we fill up the array with say 2 million elements, that should give an array of slightly less than 4MB. However, saving the map the size increases from 8.8MB (first person template), to 128.8MB.
Where is all this data coming from? Is this due to the reflection code generated by Unreal?
Is there any way to store a big array without this increase in map size?
Note: If instead I fill the array with FVector, the size scales as expected.