Skip to content

Commit

Permalink
Handle user selecting an object from a scene (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Unity-Harry committed Aug 24, 2019
1 parent 54bb916 commit b7a1105
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions AssetDependencyGraph/Editor/AssetDependencyGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ public void OnDisable()
private void ExplodeAsset()
{
Object obj = Selection.activeObject;
if (!obj)
return;

string assetPath = AssetDatabase.GetAssetPath(obj);

// assetPath will be empty is obj is null or isn't an asset (a scene object)
if (obj == null || string.IsNullOrEmpty(assetPath))
return;

Group groupNode = new Group {title = obj.name};
Object mainObject = AssetDatabase.LoadMainAssetAtPath(assetPath);

Expand Down

0 comments on commit b7a1105

Please sign in to comment.