Texture2D renderedMap = new Texture2D(GridControl.TileSizeGridControl.TileAcross, GridControl.TileSizeGridControl.TileHigh);
Rect gridSpace = new Rect(grid.position.x, grid.position.y, GridControl.TileSize * GridControl.TileAcross, GridControl.TileSize * GridControl.TileHigh);
renderedMap.ReadPixels(new Rect(gridSpace.x, gridSpace.y, gridSpace.width * 100, gridSpace.height * 100), 0, 0);
renderedMap.Apply();
//Save file
byte[] mapBytes = renderedMap.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/Rendered Maps/rm" + gridSpace.width.ToString() + gridSpace.height.ToString() + ".png", mapBytes);
Error says: “Trying to read pixel out of bounds, reading (0, 0, 320, 320) from (235, 282)”
Any help is appreciated. This is all the applicable code there is.