Skip to content

[Cross-pipeline] HDRP Wizard window appears on opening a new URP project if both pipelines are present. #4898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed Intensity Multiplier not affecting realtime global illumination.
- Fixed an exception when opening the color picker in the material UI (case 1307143).
- Fixed lights shadow frustum near and far planes.
- The HDRP Wizard is only opened when a SRP in use is of type HDRenderPipeline.
- Fixed various issues with non-temporal SSAO and rendergraph.
- Fixed white flashes on camera cuts on volumetric fog.
- Fixed light layer issue when performing editing on multiple lights.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ static void OpenWindow()
HDUserSettings.wizardPopupAlreadyShownOnce = true;
}

[MenuItem("Window/Rendering/HDRP Wizard", priority = 10000, validate = true)]
static bool CanShowWizard()
{
// If the user has more than one SRP installed, only show the Wizard if the pipeline is HDRP
return HDRenderPipeline.isReady;
}

void OnGUI()
{
if (m_BaseUpdatable == null)
Expand All @@ -245,23 +252,46 @@ static HDWizard()

static void WizardBehaviourDelayed()
{
if (!HDProjectSettings.wizardIsStartPopup)
throw new Exception(
$"HDProjectSettings.wizardIsStartPopup must be true");

if (frameToWait > 0)
--frameToWait;
else
{
EditorApplication.update -= WizardBehaviourDelayed;
--frameToWait;
return;
}

if (HDProjectSettings.wizardIsStartPopup && !HDUserSettings.wizardPopupAlreadyShownOnce)
{
//Application.isPlaying cannot be called in constructor. Do it here
if (Application.isPlaying)
return;
// No need to update this method, unsubscribe from the application update
EditorApplication.update -= WizardBehaviourDelayed;

OpenWindow();
}
//Application.isPlaying cannot be called in constructor. Do it here
if (Application.isPlaying)
return;

EditorApplication.quitting += () => HDUserSettings.wizardPopupAlreadyShownOnce = false;
EditorApplication.quitting += () => HDUserSettings.wizardPopupAlreadyShownOnce = false;

ShowWizardFirstTime();
}

static void ShowWizardFirstTime()
{
// Unsubscribe from possible events
// If the event has not been registered the unsubscribe will do nothing
RenderPipelineManager.activeRenderPipelineTypeChanged -= ShowWizardFirstTime;

if (!CanShowWizard())
{
// Delay the show of the wizard for the first time that the user is using HDRP
RenderPipelineManager.activeRenderPipelineTypeChanged += ShowWizardFirstTime;
return;
}

// If we reach this point can be because
// - That the user started Unity with HDRP in use
// - That the SRP has changed to HDRP for the first time in the session
if (!HDUserSettings.wizardPopupAlreadyShownOnce)
OpenWindow();
}

[Callbacks.DidReloadScripts]
Expand All @@ -277,6 +307,10 @@ static void CheckPersistencyPopupAlreadyOpened()
[Callbacks.DidReloadScripts]
static void WizardBehaviour()
{
// If the wizard does not need to be shown at start up, do nothing.
if (!HDProjectSettings.wizardIsStartPopup)
return;

//We need to wait at least one frame or the popup will not show up
frameToWait = 10;
EditorApplication.update += WizardBehaviourDelayed;
Expand Down