diff --git a/Assets/Scripts/ImportGltfast.cs b/Assets/Scripts/ImportGltfast.cs index 25a926d9f..c0ae652fb 100644 --- a/Assets/Scripts/ImportGltfast.cs +++ b/Assets/Scripts/ImportGltfast.cs @@ -120,7 +120,10 @@ private static async Task _ImportUsingUnityGltf( try { ImportOptions options = new ImportOptions(); - GLTFSceneImporter gltf = new GLTFSceneImporter(localPath, options); + + // See https://github.com/KhronosGroup/UnityGLTF/issues/805 + var uriPath = $"file:///{ Uri.UnescapeDataString(localPath).Replace("\\","/")}"; + GLTFSceneImporter gltf = new GLTFSceneImporter(uriPath, options); gltf.IsMultithreaded = false; AsyncHelpers.RunSync(() => gltf.LoadSceneAsync()); diff --git a/Assets/Scripts/Poly/IcosaRawAsset.cs b/Assets/Scripts/Poly/IcosaRawAsset.cs index b845c0e10..70dfd5f1a 100644 --- a/Assets/Scripts/Poly/IcosaRawAsset.cs +++ b/Assets/Scripts/Poly/IcosaRawAsset.cs @@ -144,8 +144,9 @@ public bool WriteToDisk() UnityEngine.Debug.LogErrorFormat("Caller did not create directory for me: {0}", assetDir); } string rootFilePath = Path.Combine(assetDir, GetPolySanitizedFilePath(m_RootElement.filePath)); + var unescapedRootFilePath = Uri.UnescapeDataString(rootFilePath); if (!FileUtils.InitializeDirectory(Path.GetDirectoryName(rootFilePath)) || - !FileUtils.WriteBytesIgnoreExceptions(m_RootElement.assetBytes, rootFilePath)) + !FileUtils.WriteBytesIgnoreExceptions(m_RootElement.assetBytes, unescapedRootFilePath)) { return false; } @@ -155,8 +156,9 @@ public bool WriteToDisk() for (int j = 0; j < m_ResourceElements.Count; ++j) { string filePath = Path.Combine(assetDir, GetPolySanitizedFilePath(m_ResourceElements[j].filePath)); + string unescapedFilePath = Uri.UnescapeDataString(filePath); if (!FileUtils.InitializeDirectory(Path.GetDirectoryName(filePath)) || - !FileUtils.WriteBytesIgnoreExceptions(m_ResourceElements[j].assetBytes, filePath)) + !FileUtils.WriteBytesIgnoreExceptions(m_ResourceElements[j].assetBytes, unescapedFilePath)) { RemoveFiles(written); return false;