Spawning actors to a grid?

Depends on how they should snap. Should the user select the point?

It’s really not enough information to help you out.

When you want the spawned object to snap to the nearest element of the grid it’s really easy.

Spawn a 2D Array of Grid-Elements and save their X-Y-ID and position. When an object is spawned get the current worldPosition and based on the position of the first grid-element and the distance between each grid-cell you can calculate the nearest grid cell ID. Then you just need a function that iterates through all grid-cells and returns the WorldPosition of the grid with that ID.

FVector gridBase = getCellLocationAt(0,0); // get the world location of the cell 0|0
float cellDist = 50.f; // the distance between each cell of the grid
FVector newObjectLoc = obj->GetActorLocation(); //Get Actor Loc
FVector dist = gridBase - newObjLoc; // Distance
int32 X_ID = floor(dist.X / cellDist);
int32 Y_ID = floor(dist.Y / cellDist);
if(dist.X % cellDist > cellDist/2) X_ID++; // Check which element is closer
if(dist.Y % cellDist > cellDist/2) Y_ID++: // and for Y
FVector finalSnapLocation = getCellLocationAt(X_ID,Y_ID); // TADAA