C++ code spawns actor twice

I’m trying to spawn a random of 4 bluprints wich content sprite. But when I start dragging there is a sprite under cursor, and when I release LMB there spawns another one in the same place, but a random other.

Here is the code
PuzzleCrystal.h:

#pragma once

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

UCLASS()
class PUZZLEFROMZIRO_API APuzzleCrystal : public AActor
{
	GENERATED_UCLASS_BODY()
	
	
public:	
	APuzzleCrystal(FVector location);
	
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, Category = General)
		TSubclassOf<class AActor> WhatToSpawn;
	
	UPROPERTY(Category = Block, VisibleDefaultsOnly, BLueprintReadOnly, meta = (AllowPrivateAccess = "true"))
	class UBlueprint* Crystal;

};

And PuzzleCrystal.cpp:

#include "PuzzleFromZiro.h"
#include "PuzzleCrystal.h"



// Sets default values
APuzzleCrystal::APuzzleCrystal(FVector location)
{
	// 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;
	
	struct FConstructorStatics
	{
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalRed;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalBlue;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalGreen;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalYellow;
		FConstructorStatics()
			:CrystalRed(TEXT("/Game/Objects/Crystal/Blueprit/Red.Red"))
			, CrystalBlue(TEXT("/Game/Objects/Crystal/Blueprit/Blue.Blue"))
			, CrystalGreen(TEXT("/Game/Objects/Crystal/Blueprit/Green.Green"))
			, CrystalYellow(TEXT("/Game/Objects/Crystal/Blueprit/Yellow.Yellow"))
		{
		}
	};

	
	static FConstructorStatics ConstructorStatics;
	location = { 0.0, 0.0, 0.0 };
	Crystal = CreateDefaultSubobject<UBlueprint>(TEXT("Crystal0"));
	switch (rand() % 4)
	{
	case 0:Crystal = ConstructorStatics.CrystalRed.Get();
		break;
	case 1:Crystal = ConstructorStatics.CrystalBlue.Get();
		break;
	case 2:Crystal = ConstructorStatics.CrystalGreen.Get();
		break;
	case 3:Crystal = ConstructorStatics.CrystalYellow.Get();
		break;
	}
	 WhatToSpawn = (UClass*)Crystal->GeneratedClass;
	if (WhatToSpawn != NULL)
	{
		FActorSpawnParameters SpawnParametrs;
		SpawnParametrs.Owner = this;
		SpawnParametrs.Instigator = Instigator;
		SpawnParametrs.bAllowDuringConstructionScript = false;
		SpawnParametrs.bNoFail = true;
		UWorld* const World = GetWorld();
		if (World)
		{
			AActor* SpawningObject = World->SpawnActor<AActor>(WhatToSpawn, location, { 90.0, 0.0, -90.0 }, SpawnParametrs);
		}
	}
}

// Called when the game starts or when spawned
void APuzzleCrystal::BeginPlay()
{
	Super::BeginPlay();

}

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

}

Is this what you want?

PuzzleCrystal.h

#pragma once

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

UCLASS()
class APuzzleCrystal : public AActor
{
	GENERATED_BODY()

public:
	APuzzleCrystal();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	// Called every frame
	virtual void Tick(float DeltaSeconds) override;

	UPROPERTY(EditAnywhere, Category = General)
	TSubclassOf<AActor> WhatToSpawn;

	UPROPERTY(Category = Block, VisibleDefaultsOnly, BLueprintReadOnly, meta = (AllowPrivateAccess = "true"))
	TWeakObjectPtr<AActor> Crystal;

private:
	UPROPERTY()
	class USceneComponent *Root;

	UPROPERTY()
	class UBillboardComponent *Billboard;
};

PuzzleCrystal.cpp

#include "PuzzleFromZiro.h"
#include "PuzzleCrystal.h"

#include "Components/BillboardComponent.h"

// Sets default values
APuzzleCrystal::APuzzleCrystal()
{
	// 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;

	struct FConstructorStatics
	{
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalRed;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalBlue;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalGreen;
		ConstructorHelpers::FObjectFinderOptional<UBlueprint> CrystalYellow;
		FConstructorStatics()
			:CrystalRed(TEXT("/Game/Objects/Crystal/Blueprint/Red.Red"))
			, CrystalBlue(TEXT("/Game/Objects/Crystal/Blueprint/Blue.Blue"))
			, CrystalGreen(TEXT("/Game/Objects/Crystal/Blueprint/Green.Green"))
			, CrystalYellow(TEXT("/Game/Objects/Crystal/Blueprint/Yellow.Yellow"))
		{
		}
	};


	static FConstructorStatics ConstructorStatics;

	Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
	RootComponent = Root;

	Billboard = CreateDefaultSubobject<UBillboardComponent>(TEXT("Billboard"));
	Billboard->AttachTo(RootComponent);

	UBlueprint *CrystalType = nullptr;
	switch (rand() % 4)
	{
	case 0:CrystalType = ConstructorStatics.CrystalRed.Get();
		break;
	case 1:CrystalType = ConstructorStatics.CrystalBlue.Get();
		break;
	case 2:CrystalType = ConstructorStatics.CrystalGreen.Get();
		break;
	case 3:CrystalType = ConstructorStatics.CrystalYellow.Get();
		break;
	}

	if (CrystalType)
		WhatToSpawn = (UClass*)CrystalType->GeneratedClass;
}

// Called when the game starts or when spawned
void APuzzleCrystal::BeginPlay()
{
	Super::BeginPlay();

	if (WhatToSpawn != NULL)
	{
		FActorSpawnParameters SpawnParametrs;
		SpawnParametrs.Owner = this;
		SpawnParametrs.bNoFail = true;
		UWorld* const World = GetWorld();
		if (World)
		{
			Crystal = World->SpawnActor<AActor>(WhatToSpawn, GetActorLocation(), 
				{ 90.0, 0.0, -90.0 }, SpawnParametrs);
		}
	}
}

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

}

Thanks, that helps!

One more question. How can I spawn many objects. When I try create object of APuzzleCrystal class ue4 crushes. How can I spaw object of APuzzleCrystal class in location that I need?