File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Assets/com.alelievr.NodeGraphProcessor Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1
- using System . Collections ;
2
- using System . Collections . Generic ;
3
- using UnityEngine ;
1
+ using UnityEngine ;
4
2
using UnityEditor ;
5
- using UnityEditor . Callbacks ;
6
3
7
4
namespace GraphProcessor
8
5
{
@@ -11,16 +8,20 @@ public class DeleteCallback : UnityEditor.AssetModificationProcessor
11
8
{
12
9
static AssetDeleteResult OnWillDeleteAsset ( string path , RemoveAssetOptions options )
13
10
{
14
- var graph = AssetDatabase . LoadAssetAtPath ( path , typeof ( BaseGraph ) ) ;
11
+ var objects = AssetDatabase . LoadAllAssetsAtPath ( path ) ;
15
12
16
- if ( graph != null )
13
+ foreach ( var obj in objects )
17
14
{
18
- foreach ( var graphWindow in Resources . FindObjectsOfTypeAll < BaseGraphWindow > ( ) )
19
- graphWindow . OnGraphDeleted ( ) ;
15
+ if ( obj is BaseGraph b )
16
+ {
17
+ foreach ( var graphWindow in Resources . FindObjectsOfTypeAll < BaseGraphWindow > ( ) )
18
+ graphWindow . OnGraphDeleted ( ) ;
19
+
20
+ b . OnAssetDeleted ( ) ;
21
+ }
20
22
}
21
23
22
24
return AssetDeleteResult . DidNotDelete ;
23
25
}
24
26
}
25
-
26
27
}
Original file line number Diff line number Diff line change @@ -214,6 +214,8 @@ protected virtual void OnDisable()
214
214
node . DisableInternal ( ) ;
215
215
}
216
216
217
+ public virtual void OnAssetDeleted ( ) { }
218
+
217
219
/// <summary>
218
220
/// Adds a node to the graph
219
221
/// </summary>
You can’t perform that action at this time.
0 commit comments