Skip to content

Deleting graph while graph window is open throws errors #49

@loosegrid

Description

@loosegrid

Pretty obvious what went wrong when this happens, but errors are thrown every update so it seems like it should be handled in some way.

Repro

  • Create a graph (I used MonoGraphModel) and open it
  • Add a node
  • Delete the graph component

Result: this error is thrown until the window is closed

SerializedObject target has been destroyed.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
NewGraph.NodeModel:SetPosition (single,single) (at Assets/NewGraph/Models/NodeModel.cs:174)
NewGraph.NodeController:SetPosition (single,single) (at Assets/NewGraph/Editor/Controllers/NodeController.cs:67)
NewGraph.NodeView:SetPosition (UnityEngine.Vector2) (at Assets/NewGraph/Editor/Views/NodeView.cs:313)
GraphViewBase.GraphElement:ApplyDeltaToPosition (UnityEngine.Vector2) (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/Graph/GraphElement.cs:128)
GraphViewBase.GraphElementContainer:HandleDrag (GraphViewBase.DragEvent,GraphViewBase.BaseNode) (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/GraphElementContainer.cs:208)
GraphViewBase.GraphElementContainer:OnDrag (GraphViewBase.DragEvent) (at ./Library/PackageCache/com.gentlymad.graphviewbase@9e7e3c3574/Editor/Elements/GraphElementContainer.cs:202)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Expected result

I'm not sure what the preferred / simplest way to handle this would be. When deleting open scenes in Unity, the behavior is that the scene is marked dirty and you're asked if you want to save it whenever you close it or the editor. Just closing the graph window would make sense as well. Catching the error and throwing a message to tell the user to close the window also seems fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions