Skip to content

Commit 5f6680f

Browse files
authored
Merge pull request #246 from Unity-Technologies/UNI-32730-fix-unit-test-getobject-error
UNI-32730 refresh asset database in between deleting/copying
2 parents 13a1c1f + e88facf commit 5f6680f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,9 @@ private void ReplaceFile ()
12651265
} catch (IOException) {
12661266
}
12671267

1268+
// refresh the database so Unity knows the file's been deleted
1269+
AssetDatabase.Refresh();
1270+
12681271
if (File.Exists (m_lastFilePath)) {
12691272
Debug.LogWarning ("Failed to delete file: " + m_lastFilePath);
12701273
}

Assets/FbxExporters/Editor/UnitTests/FbxPrefabTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,16 @@ public void TestTransformAndReparenting()
425425
var newCopyPath = ModelExporter.ExportObject(
426426
GetRandomFbxFilePath(), root);
427427
SleepForFileTimestamp();
428+
429+
var destFile = new FbxPrefabAutoUpdater.FbxPrefabUtility (original.GetComponent<FbxPrefab> ()).GetFbxAssetPath ();
430+
if (System.IO.File.Exists (destFile)) {
431+
System.IO.File.Delete (destFile);
432+
}
433+
AssetDatabase.Refresh ();
428434
System.IO.File.Copy(
429435
newCopyPath,
430-
new FbxPrefabAutoUpdater.FbxPrefabUtility(original.GetComponent<FbxPrefab>()).GetFbxAssetPath(),
431-
overwrite: true);
436+
destFile,
437+
overwrite: false);
432438
AssetDatabase.Refresh();
433439

434440
// Make sure the update took.

0 commit comments

Comments
 (0)