Skip to content

Commit

Permalink
[ShaderGraph] [Ruby] [2022.1] Fix "view shader" commands to not block…
Browse files Browse the repository at this point in the history
… Unity from closing, use same editor instance (#5735)

* Use OpenFileAtLineExternal instead of directly invoking script editor process...

* Adding changelog

* Update call to go through CodeEditors

Co-authored-by: Jesse Barker <jesseb@unity3d.com>
  • Loading branch information
Chris Tchou and jessebarker authored Sep 21, 2021
1 parent 44259f5 commit fbe3aa2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
1 change: 1 addition & 0 deletions com.unity.shadergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The version number for this package has increased due to a version update of a r
- Fixed the appearance (wrong text color, and not wrapped) of a warning in Node Settings [1356725] (https://issuetracker.unity3d.com/product/unity/issues/guid/1356725/)
- Fixed the ordering of inputs on a SubGraph node to match the properties on the blackboard of the subgraph itself [1354463]
- Added more inputs to the Parallax Occlusion Mapping node to handle non-uniformly scaled UVs such as HDRP/Lit POM [1347008].
- Fixed an issue where ShaderGraph "view shader" commands were opening in individual windows, and blocking Unity from closing [1367188]

## [12.0.0] - 2021-01-11

Expand Down
23 changes: 1 addition & 22 deletions com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,26 +362,6 @@ public static bool WriteToFile(string path, string content)
}
}

static ProcessStartInfo CreateProcessStartInfo(string filePath)
{
string externalScriptEditor = ScriptEditorUtility.GetExternalScriptEditor();

ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = false;


#if UNITY_EDITOR_OSX
string arg = string.Format("-a \"{0}\" -n --args \"{1}\"", externalScriptEditor, Path.GetFullPath(filePath));
psi.FileName = "open";
psi.Arguments = arg;
#else
psi.Arguments = Path.GetFileName(filePath);
psi.WorkingDirectory = Path.GetDirectoryName(filePath);
psi.FileName = externalScriptEditor;
#endif
return psi;
}

public static void OpenFile(string path)
{
string filePath = Path.GetFullPath(path);
Expand All @@ -394,8 +374,7 @@ public static void OpenFile(string path)
string externalScriptEditor = ScriptEditorUtility.GetExternalScriptEditor();
if (externalScriptEditor != "internal")
{
ProcessStartInfo psi = CreateProcessStartInfo(filePath);
Process.Start(psi);
InternalEditorUtility.OpenFileAtLineExternal(filePath, 0);
}
else
{
Expand Down

0 comments on commit fbe3aa2

Please sign in to comment.