/// <summary>
        /// Constructs a new TileMesh instance
        /// </summary>
        /// <param name="tile">Tile to attach mesh to</param>
        /// <param name="lodLevel">LOD level to reference when creating heightmap and mesh</param>
        public TileMesh(Tile tile, LodData.LodLevel lodLevel)
        {
            _tile    = tile;
            LodLevel = lodLevel;

            ComputedMeshes = new List <KeyValuePair <int, MeshData> >(3);
        }
        /// <summary>
        /// Fully constructs this Tile. This includes creating a Mesh, painting
        /// the terrain, and adding details (grass, objects, etc.)
        ///
        /// By default, calculating heights is done off of the main thread but
        /// can be disabled.
        /// </summary>
        /// <param name="onComplete">Called after all calculations have completed.
        /// <see cref="onComplete"/>Can be null if the result is not needed.</param>
        /// <param name="async">Perform mesh computation asynchronously</param>
        public void Generate(Action onComplete, bool async = true)
        {
            //Cache current LOD
            _lastGeneratedLodLevel = GetLodLevel();
            MeshManager.LodLevel   = _lastGeneratedLodLevel;

            if (async)
            {
                MeshManager.CreateHeightmapAsync(() => {
                    MeshManager.CreateMesh();
                    PostCreateMeshGenerate();

                    if (onComplete != null)
                    {
                        onComplete();
                    }
                });
            }
            else
            {
                MeshManager.CreateHeightmap();
                MeshManager.CreateMesh();
                PostCreateMeshGenerate();

                if (onComplete != null)
                {
                    onComplete();
                }
            }
        }
        /// <summary>
        /// Displays a GUI for the passed <see cref="LodData.LodLevel"/>
        /// and modifies its values.
        /// </summary>
        /// <param name="name">String name to display on the foldout</param>
        /// <param name="level">LodLevel to modify</param>
        private LodData.LodLevel General_LodFoldout(string name, LodData.LodLevel level)
        {
            EditorGUILayout.Foldout(true, name);
            EditorGUI.indentLevel++;

            string[] strMeshResOpts = { "32", "64", "128" };
            string[] strMapResOpts  = { "32", "64", "128", "256" };

            int[] meshResOpts = { 32, 64, 128 };
            int[] mapResOpts  = { 32, 64, 128, 256 };

            level.StartRadius        = EditorGUILayout.IntField("Start Radius", level.StartRadius);
            level.MapResolution      = EditorGUILayout.IntPopup("Map Res", level.MapResolution, strMapResOpts, mapResOpts);
            level.SplatmapResolution = EditorGUILayout.IntPopup("Splat Res", level.SplatmapResolution, strMapResOpts, mapResOpts);
            level.MeshResolution     = EditorGUILayout.IntPopup("Mesh Res", level.MeshResolution, strMeshResOpts, meshResOpts);
            EditorGUI.indentLevel--;

            return(level);
        }