Skip to content

Commit b7a1105

Browse files
committed
Handle user selecting an object from a scene (#3)
1 parent 54bb916 commit b7a1105

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

AssetDependencyGraph/Editor/AssetDependencyGraph.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ public void OnDisable()
105105
private void ExplodeAsset()
106106
{
107107
Object obj = Selection.activeObject;
108-
if (!obj)
109-
return;
110-
111108
string assetPath = AssetDatabase.GetAssetPath(obj);
112109

110+
// assetPath will be empty is obj is null or isn't an asset (a scene object)
111+
if (obj == null || string.IsNullOrEmpty(assetPath))
112+
return;
113+
113114
Group groupNode = new Group {title = obj.name};
114115
Object mainObject = AssetDatabase.LoadMainAssetAtPath(assetPath);
115116

0 commit comments

Comments
 (0)