public void GenerateClimableMeshes(TryFunc <Face, IEnumerable <TaggedEdge <Face, Edge> > > shortest) { var faceMeshes = new List <CombineInstance>(); var climableFaces = _grid.GetClimableFaces().Where(f => GetPathCount(shortest, f) > 0); //int biggestDistance = climableFaces.First(f => f.DistanceFromZero < _ridiculusHighNumber).DistanceFromZero; foreach (var face in climableFaces) { float t = 0; t = face.DistanceFromZero * 0.01f;//biggestDistance; t = Mathf.Clamp01(t); Mesh faceMesh; faceMesh = Drawing.MakeFace(face.Center, face.Direction, 1, t); if (face.DistanceFromZero < RidiculousHighNumber) { faceMeshes.Add(new CombineInstance() { mesh = faceMesh }); } } var mesh = new Mesh() { indexFormat = UnityEngine.Rendering.IndexFormat.UInt32 }; mesh.CombineMeshes(faceMeshes.ToArray(), true, false, false); _mesh = mesh; }