Bit of code repeated 4 times under different conditions, making unity "not respond"

for (int DirtPlaceY1 = 0; DirtPlaceY1 < 6; DirtPlaceY1 ++)
{
for (int DirtPlaceX1 = 3; DirtPlaceX1 < 15; DirtPlaceX1 ++)
{
GameObject CurrentCube3 = Instantiate (CubeGet, new Vector2 (HousePosition.x + DirtPlaceX1, HousePosition.y - DirtPlaceY1), Quaternion.identity) as GameObject;
CurrentCube3.GetComponent ().Type = Cube.Types.Dirt;
CurrentCube3 = Instantiate (CubeGet, new Vector2 (HousePosition.x + DirtPlaceX1, HousePosition.y + DirtPlaceY1), Quaternion.identity) as GameObject;
CurrentCube3.GetComponent ().Type = Cube.Types.Dirt;
}
}
for (int DirtPlaceX2 = 0; DirtPlaceX2 < 3; DirtPlaceX2 ++)
{
for (int DirtPlaceY2 = 3; DirtPlaceY2 < 12; DirtPlaceY2 ++)
{
GameObject CurrentCube3 = Instantiate (CubeGet, new Vector2 (HousePosition.x - DirtPlaceX2, HousePosition.y + DirtPlaceY2), Quaternion.identity) as GameObject;
CurrentCube3.GetComponent ().Type = Cube.Types.Dirt;
CurrentCube3 = Instantiate (CubeGet, new Vector2 (HousePosition.x + DirtPlaceX2, HousePosition.y + DirtPlaceY2), Quaternion.identity) as GameObject;
CurrentCube3.GetComponent ().Type = Cube.Types.Dirt;
}
}

Let me guess you put this in Update function? Calls to GetComponent functions are heavy, and you are making so many calls per frame, it’s going to freeze. You making 312 calls to GetComponent and Instantiate each frame.