public async Task Load(IStorage storage, Action <float> progress) { this.storage = storage; if (_textures.Count == 0) { // // runtime // CreateTextureItems(); await Task.Yield(); progress.Invoke(0.1f); } else { // // already CreateTextures(by assetPostProcessor or editor menu) // } // yield return TexturesProcessOnAnyThread(); // progress.Invoke(0.15f); // yield return TexturesProcessOnMainThread(); // progress.Invoke(0.2f); //Debug.Log("start load material"); await LoadMaterials(); progress.Invoke(0.3f); // if (gltf.meshes.SelectMany(x => x.primitives) // .Any(x => x.extensions.KHR_draco_mesh_compression != null)) // { //throw new UniGLTFNotSupportedException("draco is not supported"); // } // meshes //var meshImporter = new MeshImporter(); for (int i = 0; i < gltf.meshes.Count; ++i) { var index = i; using (MeasureTime("ReadMesh")) { //Debug.Log("read mesh ... " + index); // var x = meshImporter.ReadMesh(this, index); // var meshWithMaterials = meshImporter.BuildMesh(this, x); var meshWithMaterials = _meshImporter.BuildMesh(gltf, index); await Task.Yield(); meshWithMaterials.materials = meshWithMaterials.materialIndices.Select(x => GetMaterial(x)).ToArray(); var mesh = meshWithMaterials.mesh; // mesh name if (string.IsNullOrEmpty(mesh.name)) { mesh.name = $"GLTFuma import#{i}"; } var originalName = mesh.name; for (int j = 1; meshes.Any(y => y.mesh.name == mesh.name); ++j) { mesh.name = string.Format("{0}({1})", originalName, j); } await Task.Yield(); meshes.Add(meshWithMaterials); await Task.Yield(); progress.Invoke(0.3f + 0.5f * (i + 1) / gltf.meshes.Count); } } await LoadNodes(); progress.Invoke(0.9f); //Debug.Log("start BuildHierarchy "); await BuildHierarchy(); using (MeasureTime("AnimationImporter")) { //Debug.Log("animators...."); _animationImporter.ImportAnimation(this); } OnLoadModel(); progress.Invoke(1); await Task.Yield(); if (showSpeedLog) { Debug.Log(GetSpeedLog()); } }