TArray cant add custom objects

Hi,

I have a class named ItemStat and a class named Item, they inherit from Actor.
I want to be able to create a Item with an TArray of ItemStats. I cant get this to work. I’ve tried for days now.

ItemStat:

#pragma once

#include "GameFramework/Actor.h"
#include "ItemStat.generated.h"

UCLASS()
class CODEFPS_API AItemStat : public AActor
{
	GENERATED_BODY()
	
public:	

	AItemStat();

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats)
		FString Name;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats)
		float Value;
	
};

#include "CodeFPS.h"
#include "ItemStat.h"

// Sets default values
AItemStat::AItemStat()
{

	Name = "Lasse";
	Value = 10;
}

Item

#pragma once

#include "GameFramework/Actor.h"
#include "ItemStat.h"
#include "Item.generated.h"

UCLASS()
class CODEFPS_API AItem : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AItem();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats)
	TArray<AItemStat*> Stats;
};
#include "CodeFPS.h"
#include "ItemStat.h"
#include "Item.h"


// Sets default values
AItem::AItem()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}

// Called when the game starts or when spawned
void AItem::BeginPlay()
{
	Super::BeginPlay();
	AItemStat* tempAItemStat = NULL;
	tempAItemStat->Name = "NameOne";
	tempAItemStat->Value = 10;
	Stats.Add(tempAItemStat);

}

// Called every frame
void AItem::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	
}

I started to put my itemstat creation in the constructor but i read that was wrong so i put in begin play instead.

Basically this code here dosn’t work

AItemStat* tempAItemStat = NULL;
tempAItemStat->Name = “NameOne”;
tempAItemStat->Value = 10;
Stats.Add(tempAItemStat);

I have tried everything, this compiles but crash when i use it in a blueprint. It crashed when I had it in the constructor on startup.

Any help appriciated.

I got this to work.
I changed the itemstat to a UObject and declared it in the .h but instanciated it in the .cpp like this

	tempUItemStat = NewObject<UItemStat>();
	tempUItemStat->Name = "NameOne";
	tempUItemStat->Value = 10;
	Stats.Add(tempUItemStat);