public Thread LoadFromFileWithTextures(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null) #endif { var extension = FileUtils.GetFileExtension(filename); if (basePath == null) { basePath = FileUtils.GetFileDirectory(filename); } var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { var fileData = FileUtils.LoadFileData(filename); InternalLoadFromMemoryAndZip(fileData, extension, basePath, options, usesWrapperGameObject); }, delegate { var loadedGameObject = BuildGameObject(options, extension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
public Thread LoadFromFile(string filename, AssetLoaderOptions options = null, GameObject wrapperGameObject = null, ObjectLoadedHandle onAssetLoaded = null, string basePath = null, AssimpInterop.ProgressCallback progressCallback = null) #endif { if (basePath == null) { basePath = FileUtils.GetFileDirectory(filename); } var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromFile(filename, basePath, options, usesWrapperGameObject, progressCallback); }, delegate { var loadedGameObject = BuildGameObject(options, basePath, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } ReleaseImport(); } )); }
public Thread LoadFromBrowserFilesWithTextures(int filesCount, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = null, AssimpInterop.ProgressCallback progressCallback = null) #endif { byte[] fileData; string fileName; string fileExtension; if (!GetSupportedBrowserFileData(filesCount, out fileData, out fileName, out fileExtension)) { return(null); } var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromBrowserFiles(filesCount, fileData, fileName, fileExtension, options, usesWrapperGameObject, dataCallback, existsCallback, null, progressCallback); }, delegate { var loadedGameObject = BuildGameObject(options, fileExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } ReleaseImport(); } )); }
public Thread LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded) #endif { return(ThreadUtils.RunThread(delegate { InternalLoadFromMemoryAndZip(fileData, assetExtension, options); }, delegate { var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
public Thread LoadFromMemory(byte[] fileBytes, string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded) #endif { return(ThreadUtils.RunThread(delegate { InternalLoadFromMemory(fileBytes, filename, options); }, delegate { var loadedGameObject = BuildGameObject(options, filename, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
/// <summary> /// Internally asynchronously loads a <see cref="UnityEngine.GameObject"/> from input filename with defined options. /// </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> private object AsyncLoadFileInternal(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded) { var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromFile(filename, options, usesWrapperGameObject); }, delegate { var basePath = FileUtils.GetFileDirectory(filename); var loadedGameObject = BuildGameObject(options, basePath, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
public Thread LoadFromFile(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, Action <GameObject> onAssetLoaded) #endif { return(ThreadUtils.RunThread(delegate { InternalLoadFromFile(filename, options); }, delegate { var basePath = FileUtils.GetFileDirectory(filename); var loadedGameObject = BuildGameObject(options, basePath, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
public Thread LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null) #endif { var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromMemoryAndZip(fileData, assetExtension, basePath, options, usesWrapperGameObject); }, delegate { var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
/// <summary> /// Internally asynchronously loads a <see cref="UnityEngine.GameObject"/> from input filename with defined options. /// </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="progressCallback">Callback used to retrieve file loading percentage.</param> /// <returns>The created Thread on NET 2.0, otherwise returns the created Task.</returns> private object AsyncLoadFileInternal(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, AssimpInterop.ProgressCallback progressCallback = null) { var basePath = FileUtils.GetFileDirectory(filename); var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromFile(filename, basePath, options, usesWrapperGameObject, progressCallback); }, delegate { var loadedGameObject = BuildGameObject(options, basePath, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } ReleaseImport(); } )); }
public Thread LoadFromMemoryWithTextures(byte[] fileData, string assetExtension, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null, AssimpInterop.DataCallback dataCallback = null, AssimpInterop.ExistsCallback existsCallback = 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); }, delegate { var loadedGameObject = BuildGameObject(options, assetExtension, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }
public Thread LoadFromFile(string filename, AssetLoaderOptions options, GameObject wrapperGameObject, ObjectLoadedHandle onAssetLoaded, string basePath = null) #endif { if (basePath == null) { basePath = FileUtils.GetFileDirectory(filename); } var usesWrapperGameObject = wrapperGameObject != null; return(ThreadUtils.RunThread(delegate { InternalLoadFromFile(filename, basePath, options, usesWrapperGameObject); }, delegate { var loadedGameObject = BuildGameObject(options, basePath, wrapperGameObject); if (onAssetLoaded != null) { onAssetLoaded(loadedGameObject); } } )); }