Unity-AssetDependencyGraph icon indicating copy to clipboard operation
Unity-AssetDependencyGraph copied to clipboard

NullReferenceException when trying to Explore Scenes

Open ClementCapart opened this issue 5 years ago • 4 comments

NullReferenceException: Object reference not set to an instance of an object
AssetDependencyGraph.CreateNode (UnityEngine.Object obj, System.String assetPath, System.Boolean isMainNode, System.Boolean hasDependencies) (at Assets/Shared/Utils/Editor/AssetDependencyGraph.cs:185)
AssetDependencyGraph.CreateDependencyNodes (System.String[] dependencies, UnityEditor.Experimental.UIElements.GraphView.Node parentNode, UnityEditor.Experimental.UIElements.GraphView.Group groupNode, System.Int32 depth) (at Assets/Shared/Utils/Editor/AssetDependencyGraph.cs:145)
AssetDependencyGraph.CreateDependencyNodes (System.String[] dependencies, UnityEditor.Experimental.UIElements.GraphView.Node parentNode, UnityEditor.Experimental.UIElements.GraphView.Group groupNode, System.Int32 depth) (at Assets/Shared/Utils/Editor/AssetDependencyGraph.cs:151)
AssetDependencyGraph.ExplodeAsset () (at Assets/Shared/Utils/Editor/AssetDependencyGraph.cs:127)
UnityEngine.Experimental.UIElements.Clickable.OnMouseUp (UnityEngine.Experimental.UIElements.MouseUpEvent evt) (at C:/buildslave/unity/build/Modules/UIElements/Clickable.cs:152)
UnityEngine.Experimental.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/Events/EventCallback.cs:62)
[...]

Testing in 2018.4 I removed the rest of the callstack as I believe it's irrelevant but let me know if you need it.

I did a little bit of investigation and it is due to userData never being set on the mainNode (scenes, in my test cases) I imagine that also means there is something depending on the mainNode which doesn't make much sense since it would mean there is circular dependency.

Let me know if you need additional testing, I would look into fixing it myself if I had time but I can't at the moment. If I end up doing it, I'll open a pull request.

Thanks again for sharing that tool!

ClementCapart avatar Aug 23 '19 17:08 ClementCapart

As discussed with @LitchiSzu this is caused by the LightingData.asset causing a circular dependency with the Scene asset

Unity-Harry avatar Aug 27 '19 10:08 Unity-Harry

I have implemented a version that supports displaying circular dependencies...

YaoYilin avatar Oct 20 '20 13:10 YaoYilin

I have implemented a version that supports displaying circular dependencies...

Nice! Would you like to create a PR for those changes?

Unity-Harry avatar Oct 26 '20 15:10 Unity-Harry

Sorry so long to reply, I have uploaded to my program on GitHub。https://github.com/YaoYilin/UnityToolSet

YaoYilin avatar Sep 02 '21 04:09 YaoYilin