Skip to content

Commit 70cebd0

Browse files
authored
Merge pull request #1 from ReachCloudDevelopers/bugs/ScenePostProcessAssetEditingFix
Bugs/scene post process asset editing fix
2 parents 9492bc0 + a9ea59f commit 70cebd0

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+
AssetDatabase.StartAssetEditing();
31+
try
3332
{
34-
var lodVolume = go.GetComponent<LODVolume>();
35-
if (lodVolume)
36-
PersistHLODs(lodVolume, path);
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)