浏览代码

Add null check for OnDestroy

/main
Peter Bay Bastian 7 年前
当前提交
03aee46f
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


void OnDestroy()
{
if (graphObject.isDirty && EditorUtility.DisplayDialog("Shader Graph Might Have Been Modified", "Do you want to save the changes you made in the shader graph?", "Save", "Don't Save"))
UpdateAsset();
Undo.ClearUndo(graphObject);
DestroyImmediate(graphObject);
if (graphObject != null)
{
if (graphObject.isDirty && EditorUtility.DisplayDialog("Shader Graph Has Been Modified", "Do you want to save the changes you made in the shader graph?\n\nYour changes will be lost if you don't save them.", "Save", "Don't Save"))
UpdateAsset();
Undo.ClearUndo(graphObject);
DestroyImmediate(graphObject);
}
graphEditorView = null;
}

正在加载...
取消
保存