bool IsValidGridPos() { foreach (Transform child in transform) { Vector2 v = GridBehavior.RoundVec2(child.position); //not inside border ? if (!GridBehavior.InsideBorder(v)) { return(false); } //Block in grid cell (and not part of the same group) ? if (GridBehavior.grid[(int)v.x, (int)v.y] != null && GridBehavior.grid[(int)v.x, (int)v.y].parent != transform) { return(false); } } return(true); }