Skip to content

Conversation

cdxntchou
Copy link

@cdxntchou cdxntchou commented Sep 20, 2021

Purpose of this PR

Backports:
2022.1: #5735
2021.2: #5736

Fix for https://fogbugz.unity3d.com/f/cases/1367188/

Previously, when viewing the generated shader output via the debug commands in ShaderGraph, a separate instance of the script editor would be invoked for each generated shader, instead of re-using the existing editor.

Worse, when the user tried to close Unity, it would block on an inscrutable dialog:
image
Until the user closed all of the script editors that had been opened.

This PR fixes both issues by switching to use the script function: "OpenFileAtLineExternal" to invoke the script editor, instead of directly creating editor processes.


Testing status

  • Tested opening generated shaders via the ShaderGraph Inspector (both buttons)
  • When using Visual Studio, validated that they open in the existing VS instance
  • When VS is not running, it opens a new instance of VS.
  • Validated that changing the "script editor" preferences is reflected in what editor is opened.
  • Tested right click on node -> show generated code -- all of above works.
  • Tested right click on node -> show preview code -- all of above works.

Yamato:

PR ShaderGraph: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1367188/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_trunk/8867365/job/pipeline


Comments to reviewers

Notes for the reviewers you have assigned.

@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

Shader Graph
/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_trunk
Depending on your PR, you may also want
/.yamato%252Fall-shadergraph_builtin_foundation.yml%2523PR_ShaderGraph_BuiltIn_Foundation_trunk
/.yamato%252Fall-shadergraph_builtin_lighting.yml%2523PR_ShaderGraph_BuiltIn_Lighting_trunk

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

@cdxntchou cdxntchou marked this pull request as ready for review September 20, 2021 19:58
@cdxntchou cdxntchou requested a review from a team as a code owner September 20, 2021 19:58
Copy link
Contributor

@jessebarker jessebarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested on Mac with Visual Studio. Sublime Text still launches a new instance, but doesn't have integration like VS (or Rider).

@cdxntchou cdxntchou requested a review from a team September 20, 2021 21:26
@cdxntchou cdxntchou changed the title [ShaderGraph] Fix "view shader" commands to not block Unity from closing, use same editor instance [ShaderGraph] [Ruby] [2022.1] Fix "view shader" commands to not block Unity from closing, use same editor instance Sep 20, 2021
Copy link
Contributor

@marctem marctem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified it works with Rider on Mac.

@jessebarker jessebarker merged commit fbe3aa2 into master Sep 21, 2021
@jessebarker jessebarker deleted the sg/fix/1367188 branch September 21, 2021 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants