One last bug in the grid generator class i made. OnConstruct fires two times

So I’ve finally created a grid that can generate dynamically in the editor. I’ve got two main classes:

  1. AGridBase → Which is only an AActor with StaticMesh (plane) with a collision box , representing each block of the grid
  2. GridGenerator → The object that I spawn to generate grid bases.

The code currently works as expected with one minor issue. Whenever I spawn the grid, I get two grids like attached screenshot:

I use the onConstruct class like below:

void APlaneGenerators::OnConstruction(const FTransform& Transform)
	//Calculate the start and end position of the Grid
	int32 x = floor(xLength / xSizePlane);
	int32 y = floor(yLength / ySizePlane);
	NoPlanes = x * y; //Total number of grids

	//Clear Existing Grid
	myGrids = this->Children;
	for (AActor* actor : myGrids) {
		if (!actor)
	//Start spawning grids x*y amount
	for (int32 i = 1; i <= x; i++) {
		for (int32 j=1; j<=y; j++)

Also when constructing the grids:

UWorld* world = GetWorld();
	if (world) {
			FActorSpawnParameters spawnParams;
			spawnParams.Owner = this;

			ABaseGrid* tempActor;

			tempActor = world->SpawnActor<ABaseGrid>(ActorLocation, GetActorRotation(), spawnParams);
			if (tempActor)
				tempActor->boxCollision->SetBoxExtent(FVector::FVector(xSizePlane / 2, ySizePlane / 2, 1), false);
				tempActor->baseGrid->SetRelativeScale3D(FVector::FVector(xSizePlane / 100, ySizePlane / 100, 1));

Edit: Seems like it runs when I start dragging it, and also when i let go of the mouse.