public void GenerateMesh()
    {
        m_planetProperties.SetVerticiesCount((m_resolution * m_resolution) * 6);

        //Generate a mesh for every face of cubesphere.
        foreach (CubeSphereFace face in m_terrainFaces)
        {
            face.GenerateMesh();
        }
        //Create an array to merge the faces into one mesh.
        CombineInstance[] facesToBeMerged = new CombineInstance[m_meshFaces.Length];
        //Place meshes into array.
        for (int i = 0; i < m_meshFaces.Length; i++)
        {
            facesToBeMerged[i].mesh      = m_meshFaces[i].sharedMesh;
            facesToBeMerged[i].transform = m_meshFaces[i].transform.localToWorldMatrix;
            if (i != 0)
            {
                Destroy(m_meshFaces[i].gameObject);
            }
        }
        //Combine mesh and rename finished cubesphere object.
        m_meshFaces[0].GetComponent <MeshFilter>().mesh = new Mesh();
        m_meshFaces[0].GetComponent <MeshFilter>().mesh.CombineMeshes(facesToBeMerged);
        m_meshFaces[0].name = m_planetProperties.GetName();
        //Apply Material
        m_meshFaces[0].GetComponent <Renderer>().material = m_planetProperties.GetMaterial();
    }