private static bool ImportVoxModel(string asset) { string filename = Path.GetFileNameWithoutExtension(asset); string basename = Path.GetDirectoryName(asset); EnsureDirectoriesExist(basename); string pipelinePath = Path.Combine(Path.Combine(basename, "Pipeline/"), filename + ".asset"); NPipeContainer pipeContainer = NPipelineUtils.GetContainerForVoxPath(asset); if (!pipeContainer) { if (File.Exists(pipelinePath)) { // We don't need this anymore, as assets are reimported by the NPipeImporter anyway // AssetDatabase.ImportAsset(asset, ImportAssetOptions.Default); // Debug.Log("Did not create Pipeline for asset '" + asset + "' due to pipeline not yet ready (no problem as will get imported by the NPipeContainer anyway)"); return(false); } Debug.Log("Creating Pipeline for Voxmodel: " + asset); NPipeContainer template; bool unavailable; NPVoxUtils.LoadTemplateMetadata(out template, out unavailable); if (template == null) { if (!unavailable) { // We don't need this anymore, as assets are reimported by the NPipeImporter anyway // AssetDatabase.ImportAsset(asset, ImportAssetOptions.Default); // Debug.Log("Delay import of '" + asset + "' due to template not yet ready"); Debug.Log("did not import '" + asset + "' due to template not yet ready"); } return(false); } pipeContainer = NPipelineUtils.ClonePipeContainer(template, pipelinePath); } NPipeIImportable[] importables = NPipelineUtils.GetImportables(pipeContainer); // NPipeIImportable[] outputPipes = NPipelineUtils.FindOutputPipes(importables); foreach (NPipeIImportable importable in importables) { if (importable is NPVoxMagickaSource) { ((NPVoxMagickaSource)importable).VoxModelUUID = AssetDatabase.AssetPathToGUID(asset); } importable.Invalidate(); EditorUtility.SetDirty(importable as UnityEngine.Object); } AssetDatabase.SaveAssets(); AssetDatabase.ImportAsset(pipelinePath, ImportAssetOptions.ForceSynchronousImport); // try ForceSynchronousImport return(true); }