protected override IDisposable DoBackgroundThreadWork() { var loader = new TiltBrushUriLoader( m_localPath, Path.GetDirectoryName(m_localPath), m_useThreadedImageLoad); var options = m_fromPoly ? kPolyGltfImportOptions : kGltfImportOptions; return(ImportGltf.BeginImport(m_localPath, loader, options)); }
private static void BackgroundThreadProc(object userData) { ImportOperation operation = (ImportOperation)userData; try { using (TextReader reader = new StreamReader(new MemoryStream(operation.format.root.contents), Encoding.UTF8)) { operation.importState = ImportGltf.BeginImport( operation.format.formatType == PolyFormatType.GLTF ? GltfSchemaVersion.GLTF1 : GltfSchemaVersion.GLTF2, reader, operation.loader, operation.options); } } catch (Exception ex) { Debug.LogException(ex); operation.status = PolyStatus.Error("Error importing asset.", ex); } // Done with background thread part, let's queue it so we can finish up on the main thread. operation.instance.EnqueueFinishedOperation(operation); }