public static void createCustomBrush()
    {
        GameObject tileParentObject = new GameObject();

        if (YuME_mapEditor.selectedTiles.Count > 0)
        {
            // When creating a custom brush we need to find the lowest Z transform in the selection to become the pivot transform
            GameObject bottomLevelOfSelection = YuME_mapEditor.selectedTiles[0];

            foreach (GameObject checkObjects in YuME_mapEditor.selectedTiles)
            {
                if (checkObjects.transform.position.z < bottomLevelOfSelection.transform.position.z)
                {
                    bottomLevelOfSelection = checkObjects;
                }
            }

            // center the parent object around the lowest block to make sure all the selected brushes are centered around the parent
            tileParentObject.transform.position = bottomLevelOfSelection.transform.position;

            // Build the brush by finding the parent prefab, creating an instance and then setting it to the transform of the original scene prefab
            foreach (GameObject tile in YuME_mapEditor.selectedTiles)
            {
                GameObject newBrushObject = (GameObject)PrefabUtility.InstantiatePrefab(PrefabUtility.GetPrefabParent(tile) as GameObject);

                newBrushObject.transform.position    = tile.transform.position;
                newBrushObject.transform.eulerAngles = tile.transform.eulerAngles;
                newBrushObject.transform.localScale  = tile.transform.localScale;
                newBrushObject.transform.parent      = tileParentObject.transform;
            }

            // reset the parents position so it is zero when dropped in the scene
            tileParentObject.transform.position = Vector3.zero;

            // Add the prefab to the project
            tileParentObject.name = "CustomBrush" + YuTools_Utils.numberOfFilesInFolder(YuME_mapEditor.availableTileSets[YuME_mapEditor.currentTileSetIndex].customBrushDestinationFolder, "*_YuME.prefab") + "_YuME.prefab";
            string destinationPath = YuTools_Utils.getAssetPath(YuME_mapEditor.availableTileSets[YuME_mapEditor.currentTileSetIndex]) + "CustomBrushes/";
            PrefabUtility.CreatePrefab(destinationPath + tileParentObject.name, tileParentObject);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh(); // refesh the asset database to tell unity changes have been made

            // remove our temporary builder object
            DestroyImmediate(tileParentObject);
            YuME_mapEditor.selectedTiles.Clear();

            // reload the custom brushes
            YuME_mapEditor.loadCustomBrushes();
        }
    }