I have the following exception being thrown at compile time:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)

I know well enough what a NullReferenceException is and what causes one, but the stack trace above implies that it's being thrown by the editor or some other internal thing.

Does anyone have any advice on how to debug this?

  • \$\begingroup\$ Welcome to GDSE. The process of making a minimal reproducible example would help. While strategically reducing the code, you may discover the trigger & if not, having a minimal example would help others diagnose the problem. Also, try searching on the offending method names - a quick search for UnityEditor.Graphs.Edge.WakeUp () turned up a # of posts for unexplained exceptions that were solved by restarting Unity. \$\endgroup\$ – Pikalek Oct 1 '19 at 15:07
  • \$\begingroup\$ @Pikalek there isn't a minimal executable that could be made for this. I had rebooted etc. in case that was the problem before posting. The question wasn't a "please fix this for me" question, it's a "how can I debug this question". \$\endgroup\$ – BanksySan Oct 1 '19 at 17:03
  • \$\begingroup\$ If you've taken additional steps to resolve the problem, it would be good to include that information in your post. Building an mcve isn't just about getting code to post, it's a standard technique used to narrow the possible source of a problem. If you've done that & still get the error, that should also be in your post. My comments aren't an attempt to insult; debugging involves systematically finding a source of error - it's hard to do that without more info about the problem. \$\endgroup\$ – Pikalek Oct 1 '19 at 18:22
  • \$\begingroup\$ @Pikalek I'm not insulted, don't worry, I'm so thin skinned as that. It seems that upgrading Unity solved the problem so I don't think I'll ever know now. \$\endgroup\$ – BanksySan Oct 1 '19 at 18:36
  • \$\begingroup\$ Glad to hear you found a solution! Given the clue involved does seem likely it was an error in Unity. Please consider posting & accepting that as an answer - if if you didn't find a precise cause, posting an answer may help others who encounter similar problems. (note: there's a waiting before you can accept your own answer after posting it) \$\endgroup\$ – Pikalek Oct 1 '19 at 18:59

No idea what the original cause was, however the exception vanished after upgrading Unity so I can only assume it was something corrupted in the install/packages/other.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.