Increment of 0 by 5 equals 5 sometimes 10. Is this a race condition problem? How can I solve this?

The solution was to:

  1. Make everything UPROPERTY(Transient).
  2. Initialize UStorage in BeginPlay() with NewObject<USlotStorage>(this).

But why has this to be initialized dynamically inside BeginPlay() if it does not access any Blueprint data? Wouldn’t it load faster at runtime if it is initialized at compile time?

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class THETHIRDPERSONGAME_API UInventoryComponent : public UActorComponent
{
	GENERATED_BODY()
// ...
private:
	UPROPERTY(Transient) TObjectPtr<USlotStorage> ShotgunShells;
USTRUCT(BlueprintType)
struct FStorageInfo
{
	GENERATED_BODY()
// ...
	UPROPERTY(Transient)	int Count = 0;
void UInventoryComponent::BeginPlay()
{
	Super::BeginPlay();	
// ...
	ShotgunShells = NewObject<USlotStorage>(this);
	ShotgunShells->Init(this, InventoryLayout.ShotgunShells);
}