Fix import Exception from Unity-6.4

This commit is contained in:
ousttrue
2026-07-09 13:45:15 +09:00
parent 1e7976eb5f
commit f5881cb567

View File

@@ -81,7 +81,17 @@ namespace UniGLTF
if (!EditorTextureUtility.TryGetAsEditorTexture2DAsset(externalTexture, out var texture2D, out var importer)) return;
Configure(texDesc, importer);
importer.SaveAndReimport();
// https://github.com/vrm-c/UniVRM/issues/2813 (4)
// https://github.com/vrm-c/UniVRM/issues/2783
//
// UnityException: Calls to "AssetDatabase.ImportAsset" are restricted during asset importing.
// Please make sure this function is not called from ScriptedImporters or PostProcessors,
// as it is a source of non-determinism.
UnityEditor.EditorApplication.delayCall += () =>
{
importer.SaveAndReimport();
};
}
}
}