static void LoadLocalFbx(string path, System.Action <GameObject> process) { var loader = new TriLib.AssetLoaderAsync(); TriLib.AssetLoaderOptions opts = GetTriLibOpts(); loader.LoadFromFileWithTextures(path, opts, null, gameObject => { PrepareImportedModel(gameObject, ""); process(gameObject); }); }
static TriLib.AssetLoaderOptions GetTriLibOpts() { if (triLibOpts == null) { triLibOpts = TriLib.AssetLoaderOptions.CreateInstance(); } var opts = triLibOpts; opts.DontLoadCameras = true; opts.DontLoadLights = true; opts.UseLegacyAnimations = true; opts.GenerateMeshColliders = false; // We'll do this ourselves later. // Hmm support for alpha isn't great..the robot comes in clear if we do // this. Deal with it later, possibly manually. opts.DisableAlphaMaterials = true; return(opts); }
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input byte array with defined options. /// @warning To ensure your materials will be loaded, don´t remove material files included in the package. /// </summary> /// <param name="fileBytes">Data used to load the <see cref="UnityEngine.GameObject"/>.</param> /// <param name="filename">Original file name, if you know it. Otherwise, use the original file extension instead. (Eg: ".FBX")</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <param name="basePath">Base path from the loaded file.</param> /// <param name="dataCallback">Custom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="existsCallback">Custom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="loadTextureDataCallback">Pass this callback to load texture data from custom sources.</param> /// <param name="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> /// <example> /// @code /// protected void Awake() { /// GameObject myGameObject; /// try { /// using (var assetLoader = new AssetLoaderAsync()) { /// //In case you don't have a valid filename, set this to the file extension /// //to help TriLib assigning a file loader to this file /// //example value: ".FBX" /// var filename = "c:/models/mymodel.fbx"; /// var fileData = File.ReadAllBytes(filename); /// assetLoader.LoadFromMemory(fleData, filename, delegate(GameObject loadedGameObject) { /// Debug.Log("My object '" + loadedGameObject.name + "' has been loaded!"); /// }); /// } /// } catch (Exception e) { /// Debug.LogFormat("Unable to load mymodel.fbx. The loader returned: {0}", e); /// } /// } /// @endcode /// </example> #if !UNITY_EDITOR && (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0) && !ENABLE_IL2CPP && !ENABLE_MONO public Task LoadFromMemory(byte[] fileBytes, string filename, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, ObjectLoadedHandle onAssetLoaded = null, string basePath = null, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, LoadTextureDataCallback loadTextureDataCallback = null, AssimpInterop.ProgressCallback progressCallback = null)
/// <summary> /// Loads a <see cref="UnityEngine.GameObject"/> from input byte array (Accept ZIP files). /// </summary> /// <param name="fileData">File data.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="basePath">Base path from the loaded file.</param> /// <param name="dataCallback">Custom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="existsCallback">Custom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>Loaded <see cref="UnityEngine.GameObject"></see>.</returns> public GameObject LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, string basePath = null, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, AssimpInterop.ProgressCallback progressCallback = null) { if (basePath == null) { basePath = FileUtils.GetFileDirectory(assetExtension); } InternalLoadFromMemoryAndZip(fileData, assetExtension, basePath, options, wrapperGameObject != null, dataCallback, existsCallback, null, progressCallback); var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); ReleaseImport(); return(loadedGameObject); }
/// <summary> /// Internal asset download coroutine. /// </summary> /// <returns>The coroutine IEnumerator.</returns> /// <param name="assetUri">Asset URI.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="onAssetLoaded">On asset loaded event.</param> /// <param name="options">Asset loading options.</param> /// <param name="wrapperGameObject">Wrapper <see cref="UnityEngine.GameObject"/> to load the asset into.</param> private IEnumerator DoDownloadAsset(string assetUri, string assetExtension, ObjectLoadedHandle onAssetLoaded, AssetLoaderOptions options = null, GameObject wrapperGameObject = null) { _unityWebRequest = UnityWebRequest.Get(assetUri); _unityWebRequest.timeout = Timeout; #if UNITY_2017_3_OR_NEWER yield return(_unityWebRequest.SendWebRequest()); #else yield return(_unityWebRequest.Send()); #endif if (string.IsNullOrEmpty(_unityWebRequest.error)) { var data = _unityWebRequest.downloadHandler.data; try { if (Async) { using (var assetLoaderAsync = new AssetLoaderAsync()) { assetLoaderAsync.LoadFromMemoryWithTextures(data, assetExtension, options, wrapperGameObject, onAssetLoaded); } } else { using (var assetLoader = new AssetLoader()) { assetLoader.OnObjectLoaded += onAssetLoaded; assetLoader.LoadFromMemoryWithTextures(data, assetExtension, options, wrapperGameObject); } } } catch (Exception exception) { _error = exception.ToString(); onAssetLoaded(null); } } else { onAssetLoaded(null); } _unityWebRequest.Dispose(); _unityWebRequest = null; }
/// <summary> /// Downloads an asset. /// </summary> /// <returns><c>true</c>, if asset was downloaded, <c>false</c> otherwise.</returns> /// <param name="assetURI">Asset URI.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="onAssetLoaded">On asset loaded event.</param> /// <param name="onTexturePreLoad">On texture pre load event.</param> /// <param name="options">Asset loading options.</param> /// <param name="wrapperGameObject">Wrapper <see cref="UnityEngine.GameObject"/> to load the asset into.</param> public bool DownloadAsset(string assetURI, string assetExtension, ObjectLoadedHandle onAssetLoaded = null, TexturePreLoadHandle onTexturePreLoad = null, AssetLoaderOptions options = null, GameObject wrapperGameObject = null) { if (HasStarted && !IsDone) { return(false); } AssetURI = assetURI; AssetExtension = assetExtension; WrapperGameObject = wrapperGameObject; StartCoroutine(DoDownloadAsset(assetURI, assetExtension, onAssetLoaded, options, wrapperGameObject)); return(true); }
/// <summary> /// Loads the asset from memory processing textures. /// </summary> /// <param name="fileData">File data.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <returns><c>true</c> if model was loaded successfuly, otherwise <c>false</c>.</returns> public GameObject LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject) { InternalLoadFromMemoryAndZip(fileData, assetExtension, options); return(BuildGameObject(options, assetExtension, wrapperGameObject)); }
/// <summary> /// Asynchronously loads the asset from memory processing textures. /// </summary> /// <param name="fileData">File data.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> #if (NET_4_6 || NETFX_CORE) public Task LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded)
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input filename with defined options. /// @warning To ensure your materials will be loaded, don´t remove the material files included in the package. /// </summary> /// <param name="filename">Filename used to load the <see cref="UnityEngine.GameObject"/>.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <param name="basePath">Base path from the loaded file.</param> /// <param name="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> /// <example> /// @code /// protected void Awake() { /// GameObject myGameObject; /// try { /// using (var assetLoader = new AssetLoaderAsync()) { /// assetLoader.LoadFromFile("mymodel.fbx", null, null, delegate(GameObject loadedGameObject) { /// Debug.Log("My object '" + loadedGameObject.name + "' has been loaded!"); /// }); /// } /// } catch (Exception e) { /// Debug.LogFormat("Unable to load mymodel.fbx. The loader returned: {0}", e); /// } /// } /// @endcode /// </example> #if !UNITY_EDITOR && (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0) && !ENABLE_IL2CPP && !ENABLE_MONO public Task LoadFromFile(string filename, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, ObjectLoadedHandle onAssetLoaded = null, string basePath = null, AssimpInterop.ProgressCallback progressCallback = null)
public void Visit(PolyVoosAsset asset) { string assetName = asset.assetId; string uri = asset.GetUri(); PolyApi.GetAsset(assetName, maybeAsset => { if (MaybeLogError(assetName, maybeAsset)) { cache.CreateCacheEntry(uri, GameObject.CreatePrimitive(PrimitiveType.Cube), null); return; } PolyAsset polyAsset = maybeAsset.Value; // We need both the asset and the thumbnail to consider it "downloaded". // We'll download them in parallel, and whichever one finishes second // will call SetCacheEntry. GameObject assetObject = null; Texture2D thumbnail = null; PolyApi.FetchThumbnail(polyAsset, (_, maybeImported) => { if (MaybeLogError(assetName, maybeImported)) { return; } thumbnail = polyAsset.thumbnailTexture; // If we finished first, don't SetCacheEntry yet. if (assetObject != null) { // Ok, both resources are done. Report completion! // Set the cache (and flush the wait list) cache.CreateCacheEntry(uri, assetObject, thumbnail); } }); System.Action <GameObject> onAssetImported = importedGameObject => { cache.downloadedPolyAssets.Add(polyAsset); assetObject = importedGameObject; assetObject.name = assetName; PrepareImportedModel(assetObject, polyAsset.description); // If we finished first, don't SetCacheEntry yet. if (thumbnail != null) { // Ok, both resources are done. Report completion! // Set the cache (and flush the wait list) cache.CreateCacheEntry(uri, assetObject, thumbnail); } }; var objFormat = polyAsset.GetFormatIfExists(PolyFormatType.OBJ); var fbx = polyAsset.GetFormatIfExists(PolyFormatType.FBX); #if USE_TRILIB // Blocks models, like the pug, have both GLTFs and FBX's. But, TRILIB // doesn't seem to load Blocks FBX well, so don't do it. However, it's // not trivial to detect Blocks models. So our current heuristic is // going to simply be, only load the FBX if it has FBX but NOT OBJ. At // least as of 20190325, actual FBX uploads don't have OBJs. In the // future, we can even peek at the GLTF and see if it was generated by // Blocks. if (objFormat == null && fbx != null) { string tempDir = Util.CreateTempDirectory(); Dictionary <string, string> url2path = new Dictionary <string, string>(); foreach (var file in fbx.resources) { string localPath = System.IO.Path.Combine(tempDir, file.relativePath); url2path[file.url] = localPath; } // The root string rootPath = System.IO.Path.Combine(tempDir, fbx.root.relativePath); url2path[fbx.root.url] = rootPath; Util.DownloadFilesToDisk(url2path, () => { // All done! using (var loader = new TriLib.AssetLoaderAsync()) { TriLib.AssetLoaderOptions opts = GetTriLibOpts(); loader.LoadFromFileWithTextures(rootPath, opts, null, obj => { System.IO.Directory.Delete(tempDir, true); onAssetImported(obj); }); } }, errors => { System.IO.Directory.Delete(tempDir, true); Debug.LogError($"Could not download Poly FBX for asset ID {assetName}. Errors: {string.Join("\n", errors)}"); return; }); } else #endif { PolyApi.Import(polyAsset, cache.polyImportOptions, (_, maybeImported) => { if (MaybeLogError(assetName, maybeImported)) { return; } onAssetImported(maybeImported.Value.gameObject); }); } }); }
/// <summary> /// Loads a <see cref="UnityEngine.GameObject"/> from browser files. /// </summary> /// <param name="filesCount">Browser files count.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <param name="dataCallback">Custom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="existsCallback">Custom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> #if !UNITY_EDITOR && (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0) && !ENABLE_IL2CPP && !ENABLE_MONO public Task LoadFromMemoryWithTextures(int filesCount, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, AssimpInterop.ProgressCallback progressCallback = null)
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input byte array with defined options. /// @warning To ensure your materials will be loaded, don´t remove material files included in the package. /// </summary> /// <param name="fileBytes">Data used to load the <see cref="UnityEngine.GameObject"/>.</param> /// <param name="filename">Original file name, if you know it. Otherwise, use the original file extension instead. (Eg: ".FBX")</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> /// <example> /// @code /// protected void Awake() { /// GameObject myGameObject; /// try { /// using (var assetLoader = new AssetLoader()) { /// //In case you don't have a valid filename, set this to the file extension /// //to help TriLib assigining a file loader to this file /// //example value: ".FBX" /// var filename = "c:/models/mymodel.fbx"; /// var fileData = File.ReadAllBytes(filename); /// assetLoader.LoadFromMemory(fleData, filename, delegate(GameObject loadedGameObject) { /// Debug.Log("My object '" + loadedGameObject.name + "' has been loaded!"); /// }); /// } /// } catch (Exception e) { /// Debug.LogFormat("Unable to load mymodel.fbx. The loader returned: {0}", e); /// } /// } /// @endcode /// </example> #if (NET_4_6 || NETFX_CORE) public Task LoadFromMemory(byte[] fileBytes, string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded)
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input filename with defined options. /// @warning To ensure your materials will be loaded, don´t remove the material files included in the package. /// </summary> /// <param name="filename">Filename used to load the <see cref="UnityEngine.GameObject"/>.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> /// <example> /// @code /// protected void Awake() { /// GameObject myGameObject; /// try { /// using (var assetLoader = new AssetLoader()) { /// assetLoader.LoadFromFile("mymodel.fbx", null, null, delegate(GameObject loadedGameObject) { /// Debug.Log("My object '" + loadedGameObject.name + "' has been loaded!"); /// }); /// } /// } catch (Exception e) { /// Debug.LogFormat("Unable to load mymodel.fbx. The loader returned: {0}", e); /// } /// } /// @endcode /// </example> #if (NET_4_6 || NETFX_CORE) public Task LoadFromFile(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded)
public Thread LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded) #endif { var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromMemoryAndZip(fileData, assetExtension, options, usesWrapperGameObject); }, delegate { var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input byte array (Accept ZIP files). /// </summary> /// <param name="fileData">File data.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded</param> /// <param name="basePath">Base path from the loaded file.</param> /// <param name="dataCallback">Custom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="existsCallback">Custom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.</param> /// <param name="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> #if !UNITY_EDITOR && (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0) && !ENABLE_IL2CPP && !ENABLE_MONO public Task LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, AssimpInterop.ProgressCallback progressCallback = null)
/// <summary> /// Internal asset download coroutine. /// </summary> /// <returns>The coroutine IEnumerator.</returns> /// <param name="assetURI">Asset URI.</param> /// <param name="assetExtension">Asset extension.</param> /// <param name="onAssetLoaded">On asset loaded event.</param> /// <param name="onTexturePreLoad">On texture pre load event.</param> /// <param name="options">Asset loading options.</param> /// <param name="wrapperGameObject">Wrapper <see cref="UnityEngine.GameObject"/> to load the asset into.</param> private IEnumerator DoDownloadAsset(string assetURI, string assetExtension, ObjectLoadedHandle onAssetLoaded, TexturePreLoadHandle onTexturePreLoad = null, AssetLoaderOptions options = null, GameObject wrapperGameObject = null) { _unityWebRequest = UnityWebRequest.Get(assetURI); yield return(_unityWebRequest.Send()); if (string.IsNullOrEmpty(_unityWebRequest.error)) { var data = _unityWebRequest.downloadHandler.data; using (var assetLoader = new AssetLoader()) { assetLoader.LoadFromMemoryWithTextures(data, assetExtension, onAssetLoaded, out _error, onTexturePreLoad, options, wrapperGameObject); } } _unityWebRequest.Dispose(); _unityWebRequest = null; }
public Thread LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, AssimpInterop.ProgressCallback progressCallback = null) #endif { if (basePath == null) { basePath = FileUtils.GetFileDirectory(assetExtension); } var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromMemoryAndZip(fileData, assetExtension, basePath, options, usesWrapperGameObject, dataCallback, existsCallback, null, progressCallback); }, delegate { var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } ReleaseImport(); } )); }
public Thread LoadFromFileAsync(string filename, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, ObjectLoadedHandle onAssetLoaded = null) { return((Thread)LoadFileInternal(filename, options, wrapperGameObject, onAssetLoaded, true)); }
/// <summary> /// Asynchronously loads a <see cref="UnityEngine.GameObject"/> from input filename with defined options. /// @warning To ensure your materials will be loaded, don´t remove the material files included in the package. /// </summary> /// <param name="filename">Filename used to load the <see cref="UnityEngine.GameObject"/>.</param> /// <param name="options"><see cref="AssetLoaderOptions"/> used to load the object.</param> /// <param name="wrapperGameObject">Use this field to load the new <see cref="UnityEngine.GameObject"/> into referenced <see cref="UnityEngine.GameObject"/>.</param> /// <param name="onAssetLoaded">The action that will be executed when the <see cref="UnityEngine.GameObject"/> be loaded.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> /// <example> /// @code /// protected void Awake() { /// GameObject myGameObject; /// try { /// using (var assetLoader = new AssetLoader()) { /// assetLoader.LoadFromFile("mymodel.fbx", null, null, delegate(GameObject loadedGameObject) { /// Debug.Log("My object '" + loadedGameObject.name + "' has been loaded!"); /// }); /// } /// } catch (Exception e) { /// Debug.LogFormat("Unable to load mymodel.fbx. The loader returned: {0}", e); /// } /// } /// @endcode /// </example> #if (NET_4_6 || NETFX_CORE) public Task LoadFromFileAsync(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded) { return((Task)LoadFileInternal(filename, options, wrapperGameObject, onAssetLoaded)); }
public Thread LoadFromFileAsync(string filename, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, ObjectLoadedHandle onAssetLoaded = null, AssimpInterop.ProgressCallback progressCallback = null) { return((Thread)LoadFileInternal(filename, options, wrapperGameObject, onAssetLoaded, true, progressCallback)); }