Why does SetActorLocation sometimes double the position vector?

I have the following piece of code:

void AHexGrid::PositionTiles()
	{
	for (int32 i = 0; i < this->Columns.Num(); i++)
		{
		for (int32 j = 0; j < this->Columns[i].Tiles.Num(); j++)
			{
			AHexTile *tile = this->Columns[i].Tiles[j];
			if (tile != NULL)
				{
				FVector pos = this->GetHexPosition(i, j, 300);
				tile->SetActorLocation(pos);
				UE_LOG(LogTemp, Warning, TEXT("Tile [%d][%d] moved to %s (%s)"), i, j, *pos.ToString(), *tile->GetActorLocation().ToString());
				}
			else
				{
				UE_LOG(LogTemp, Warning, TEXT("Tile [%d][%d] is empty"), i, j);
				}
			}
		}
	}

Most of the time I get exactly what you’d expect:

LogTemp:Warning: Tile [1][5] moved to X=450.000 Y=2857.800 Z=0.000 (X=450.000 Y=2857.800 Z=0.000)

However, for a very few iterations of this loop I get the following output:

LogTemp:Warning: Tile [1][18] moved to X=450.000 Y=9612.600 Z=0.000 (X=900.000 Y=19225.199 Z=0.000)

As you can see the actual location of the actor is exactly double what I requested.

For reference:

I am calling this function when AHexGrid is contructed:

void AHexGrid::OnConstruction(const FTransform& Transform)
	{
	this->PositionTiles();
	}

Implementation of GetHexPosition:

FVector AHexGrid::GetHexPosition(int32 x, int32 y, float cornerRadius)
	{
	FVector position;
	position.X = x * cornerRadius * 1.5f;
	position.Y = (y * 2 + x) * cornerRadius * 0.866f;
	position.Z = 0;
	return position;
	}

Abbreviated class definition:

USTRUCT()
struct FHexGridColumn
	{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Object)
	TArray<AHexTile*> Tiles;
	};

UCLASS()
class BOTBATTLE_API AHexGrid : public AActor
	{
	GENERATED_UCLASS_BODY()

	private:
		void PositionTiles();

	public:
		static FVector GetHexPosition(int32 x, int32 y, float cornerRadius);
		...

		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Object)
		TArray<FHexGridColumn> Columns;

		virtual void OnConstruction(const FTransform& Transform) override; 
		...
	};

Any idea what is causing this unexpected behavior?

Correct marked lines of code.

FVector AHexGrid::GetHexPosition(int32 x, int32 y, float cornerRadius)
    {
    FVector position;
    position.X = x  cornerRadius  1.5f;   ////fix this line
    position.Y = (y  2 + x)  cornerRadius * 0.866f;  ////fix this line
    position.Z = 0;
    return position;
    }

Are tiles connected somehow in hierarchy? One tile is parent for another?

Thanks, I hadn’t noticed I messed up some of the markdown. Should display correctly now.

No, they’re grouped into folders, but none of them have parents.

Well, without your code and debugger I can’t tell what is the problem here, sorry.

Interestingly, If i manually call OnConstruction later everything is positioned correctly. Is this perhaps due to something not being fully initialized when OnConstruction is called? Is there a better place to put this sort of code?