bool ValidateHeightmap()
        {
            if (!ToolboxHelper.IsPowerOfTwo(m_Settings.HeightmapWidth) || !ToolboxHelper.IsPowerOfTwo(m_Settings.HeightmapHeight))
            {
                // texture is not power of two
                Debug.LogError("TerrainToolbox: Imported heightmap resolution is not power of two.");
                return(false);
            }

            if (m_Settings.TilesX != 0 && m_Settings.TilesZ != 0)
            {
                float tileHeightX = (float)m_Settings.HeightmapWidth / (float)m_Settings.TilesX;
                float tileHeightZ = (float)m_Settings.HeightmapWidth / (float)m_Settings.TilesZ;
                if (tileHeightX != tileHeightZ)
                {
                    // heights per tile is non-square
                    Debug.LogError("TerrainToolbox: Heightmap resolution per tile is not square size with current settings.");
                    return(false);
                }
                if (!ToolboxHelper.IsInteger(tileHeightX) || !ToolboxHelper.IsInteger(tileHeightZ))
                {
                    // heights per tile is not integer
                    Debug.LogError("TerrainToolbox: Heightmap resolution per tile is not integer with current settings. You will get seams between tiles.");
                    return(false);
                }
                if (tileHeightX > 4096 || tileHeightX < 32)
                {
                    // heightmap size per tile out of range
                    Debug.LogError("TerrainToolbox: Heightmap resolution per tile is out of range. Supported resolution is from 32 to 4096.");
                    return(false);
                }
            }

            if (m_Settings.HeightmapMode == Heightmap.Mode.Batch)
            {
                int tiles = m_Settings.TilesX * m_Settings.TilesZ;
                if (m_Settings.TileHeightmapPaths.Count != tiles)
                {
                    // missing tile heightmap files
                    Debug.LogError("TerrainToolbox: Number of heightmaps does not match number of terrain tiles.");
                    return(false);
                }
            }

            return(true);
        }