File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -22,21 +22,26 @@ public static string[] OnWillSaveAssets(string[] paths)
22
22
{
23
23
foreach ( string path in paths )
24
24
{
25
- if ( path . Contains ( ".unity" ) )
25
+ if ( path . EndsWith ( ".unity" ) )
26
26
{
27
- AssetDatabase . StartAssetEditing ( ) ;
28
-
29
27
var scene = SceneManager . GetSceneByPath ( path ) ;
30
28
if ( ! scene . IsValid ( ) ) continue ;
31
- var rootGameObjects = scene . GetRootGameObjects ( ) ;
32
- foreach ( var go in rootGameObjects )
29
+
30
+ AssetDatabase . StartAssetEditing ( ) ;
31
+ try
33
32
{
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 ( ) ;
37
44
}
38
-
39
- AssetDatabase . StopAssetEditing ( ) ;
40
45
}
41
46
}
42
47
You can’t perform that action at this time.
0 commit comments