static private GameObject CreateMerged(string name, MeshFilter[] meshFilters, Material[] materials, int layer, bool receiveShadow, ShadowCastingMode shadowCasting) { GameObject go = new GameObject(name); go.layer = layer; var renderer = go.AddComponent <MeshRenderer>(); renderer.sharedMaterials = materials; renderer.receiveShadows = receiveShadow; renderer.shadowCastingMode = shadowCasting; Mesh mesh = new Mesh(); var combinationBuilder = new MeshCombinationBuilder(); combinationBuilder.Init(meshFilters); combinationBuilder.Start(); combinationBuilder.Complete(mesh); combinationBuilder.Dispose(); var meshFilter = go.AddComponent <MeshFilter>(); meshFilter.sharedMesh = mesh; return(go); }
protected JobHandle ScheduleDeferredCombineMeshes(NativeList <DataInstance> instanceList, TileTheme theme, JobHandle dependOn) { combinationBuilder = new MeshCombinationBuilder(); AddTemp(combinationBuilder); combinationBuilder.InitDeferred(instanceList, theme); dependOn = combinationBuilder.Start(dependOn); return(dependOn); }
protected JobHandle ScheduleCombineMeshes(NativeArray <DataInstance> instanceArray, TileTheme theme, JobHandle dependOn) { combinationBuilder = new MeshCombinationBuilder(); AddTemp(combinationBuilder); combinationBuilder.Init(instanceArray, theme); dependOn = combinationBuilder.Start(dependOn); return(dependOn); }