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/2021.2%252Fsg%252Ffix%252F1367188/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_2021.2/8870350/job/pipeline


Comments to reviewers

Notes for the reviewers you have assigned.

# Conflicts:
#	com.unity.shadergraph/CHANGELOG.md
@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_2021.2
Depending on your PR, you may also want
/.yamato%252Fall-shadergraph_builtin_foundation.yml%2523PR_ShaderGraph_BuiltIn_Foundation_2021.2
/.yamato%252Fall-shadergraph_builtin_lighting.yml%2523PR_ShaderGraph_BuiltIn_Lighting_2021.2

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 21:57
@cdxntchou cdxntchou requested a review from a team as a code owner September 20, 2021 21:57
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

@cdxntchou cdxntchou requested a review from a team September 20, 2021 22:15
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.

Works fine with Rider on Mac

@jessebarker jessebarker merged commit 20c13af into 2021.2/staging Sep 20, 2021
@jessebarker jessebarker deleted the 2021.2/sg/fix/1367188 branch September 20, 2021 23:58
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