public async void Init(LayoutRouting layoutRouting, string url, System.Action <bool> callback = null) { this.layoutRouting = layoutRouting; _transform = transform; onLoadCallback = callback; if (gltfAsset == null) { gltfAsset = gameObject.AddComponent <GLTFast.GltfAsset>(); } gltfAsset.loadOnStartup = false; gltfAsset.url = url; var deferAgent = gameObject.AddComponent <WebGLDeferAgent>(); var loadResult = await gltfAsset.Load(gltfAsset.url, null, deferAgent); OnGltfLoaded(loadResult); }
private async void loadGLTF(string filePath) { Debug.Log("[ModelDownloader]: Loading file from path: " + filePath); try { var fileProvider = new LocalFileProvider(); var success = await gltfAsset.Load(filePath, fileProvider); if (!success) { Debug.LogWarning("[ModelDownloader]: failed to load model: "); } } catch (System.Exception e) { Debug.LogWarning("[ModelDownloader]: Error while loading model: " + e.Message); throw e; } }