bool isValidGridPos() { foreach (Transform child in transform) { Vector2 v = Grid2d.roundVec2(child.position); // Not inside Border? if (!Grid2d.insideBorder(v)) { return(false); } // Block in grid cell (and not part of same group)? if (Grid2d.grid[(int)v.x, (int)v.y] != null && Grid2d.grid[(int)v.x, (int)v.y].parent != transform) { return(false); } } return(true); }