/// <inheritdoc /> public void BuildMesh(Tile tile, Mesh mesh) { EnsureTile(tile); var gameObject = new GameObject(mesh.Name); var uMesh = new UnityEngine.Mesh(); uMesh.vertices = mesh.Vertices; uMesh.triangles = mesh.Triangles; uMesh.colors = mesh.Colors; uMesh.uv = mesh.Textures; uMesh.RecalculateNormals(); gameObject.isStatic = true; gameObject.AddComponent <MeshFilter>().mesh = uMesh; gameObject.AddComponent <MeshRenderer>().sharedMaterial = _customizationService.GetSharedMaterial(@"Materials/Default"); gameObject.AddComponent <MeshCollider>(); gameObject.transform.parent = tile.GameObject.transform; }
private Material GetMaterial(Element element) { return(_customizationService.GetSharedMaterial("Materials/" + element.Styles["material"])); }