Skip to content

Commit 08da8b5

Browse files
committed
Fixed AssetDatabase.Start/StopAssetEditing
1. For some reason the Start/Stop asset editing calls were not setup correctly in the scene post processor. This issue completely breaks asset bundle builds. 2. The ".unity" check should only check if the file "EndsWith" the extension, not contains. I could have a prefab named "MyPrefab.unity.prefab".
1 parent 9492bc0 commit 08da8b5

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Editor/SceneLOD.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,26 @@ public static string[] OnWillSaveAssets(string[] paths)
2222
{
2323
foreach (string path in paths)
2424
{
25-
if (path.Contains(".unity"))
25+
if (path.EndsWith(".unity"))
2626
{
27-
AssetDatabase.StartAssetEditing();
28-
2927
var scene = SceneManager.GetSceneByPath(path);
3028
if(!scene.IsValid()) continue;
31-
var rootGameObjects = scene.GetRootGameObjects();
32-
foreach (var go in rootGameObjects)
29+
30+
try
3331
{
34-
var lodVolume = go.GetComponent<LODVolume>();
35-
if (lodVolume)
36-
PersistHLODs(lodVolume, path);
32+
AssetDatabase.StartAssetEditing();
33+
var rootGameObjects = scene.GetRootGameObjects();
34+
foreach (var go in rootGameObjects)
35+
{
36+
var lodVolume = go.GetComponent<LODVolume>();
37+
if (lodVolume)
38+
PersistHLODs(lodVolume, path);
39+
}
40+
}
41+
finally
42+
{
43+
AssetDatabase.StopAssetEditing();
3744
}
38-
39-
AssetDatabase.StopAssetEditing();
4045
}
4146
}
4247

0 commit comments

Comments
 (0)