void MakeHeightMapTileable()
        {
            PortionToTile portionToTile = DeterminePortionToTile(onlyTileInner.boolValue, onlyTileOuter.boolValue);

            Terrain[,] terrains2D = GetTerrainsFromTerrainsProperty();
            TerrainErrorChecker errorChecker = new TerrainErrorChecker(terrains2D, portionToTile, emptyLocations.boolValue);

            if (!errorChecker.ProceedWithHeightmapTiling())
            {
                return;
            }

            //Allows the user to undo the heightmap changes after
#if (UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2)
            Undo.RegisterUndo(EditorTerrainTools.Get1DTerrainDataArrayFrom2DTerrainArray(targetScript.terrains), "Make HeightMap(s) Tileable");
#else
            int           startingGroup = Undo.GetCurrentGroup() + 1;
            TerrainData[] terrains      = EditorTerrainTools.Get1DTerrainDataArrayFrom2DTerrainArray(terrains2D);

            foreach (TerrainData terrain in terrains)
            {
                Undo.IncrementCurrentGroup();
                Undo.RegisterCompleteObjectUndo(terrain, "Make HeightMap(s) Tileable");
            }
            Undo.CollapseUndoOperations(startingGroup);
#endif


            TerrainData[,] data = EditorTerrainTools.Get2DTerrainDataArrayFrom2DTerrainArray(terrains2D);

            HeightmapTiler heightTiler = new HeightmapTiler(data, effectedRegionWidth.intValue, smoothEdges.boolValue);
            heightTiler.TileHeightmaps(portionToTile);
        }
        void MakeAlphaMapTileable()
        {
            PortionToTile portionToTile = DeterminePortionToTile(onlyTileInner.boolValue, onlyTileOuter.boolValue);

            Terrain[,] terrains2D = GetTerrainsFromTerrainsProperty();

            TerrainErrorChecker errorChecker = new TerrainErrorChecker(terrains2D, portionToTile, emptyLocations.boolValue);

            if (!errorChecker.ProceedWithAlphamapTiling())
            {
                return;
            }

            TerrainData[,] data = EditorTerrainTools.Get2DTerrainDataArrayFrom2DTerrainArray(terrains2D);

            //Can only occur when the alpha maps are of equal size/resolution, so don't worry about error checking
            TileableTerrainMaker targetScript = (TileableTerrainMaker)serializedObject.targetObject;

            targetScript.backupAlphaMap = new AlphamapBackupController(data);

            AlphamapTiler alphaTiler = new AlphamapTiler(data, effectedRegionWidth.intValue);

            alphaTiler.TileAlphamaps(portionToTile);
        }