Skip to content

Commit 24dc353

Browse files
authored
Hd/fix wizard defaultvolumeprofile creation (#565)
* Fix Wizard check on default volume profile * Update CHANGELOG.md
1 parent efc6860 commit 24dc353

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
617617
- Fixed taaFrameIndex and XR tests 4052 and 4053
618618
- Fixed the prefab integration of custom passes (Prefab Override Highlight not working as expected).
619619
- Cloned volume profile from read only assets are created in the root of the project. (case 1154961)
620+
- Fixed Wizard check on default volume profile to also check it is not the default one in package.
620621

621622
### Changed
622623
- Improve MIP selection for decals on Transparents

com.unity.render-pipelines.high-definition/Editor/DefaultScene/HDWizard.Configuration.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ bool IsDefaultVolumeProfileAssigned()
460460
return false;
461461

462462
var hdAsset = HDRenderPipeline.currentAsset;
463-
return hdAsset.defaultVolumeProfile != null && !hdAsset.defaultVolumeProfile.Equals(null);
463+
return hdAsset.defaultVolumeProfile != null
464+
&& !hdAsset.defaultVolumeProfile.Equals(null)
465+
&& hdAsset.defaultVolumeProfile != hdAsset.renderPipelineEditorResources.defaultSettingsVolumeProfile;
464466
}
465467
void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
466468
{
@@ -471,7 +473,19 @@ void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
471473
if (hdrpAsset == null)
472474
return;
473475

474-
EditorDefaultSettings.GetOrAssignDefaultVolumeProfile(hdrpAsset);
476+
VolumeProfile defaultSettingsVolumeProfileInPackage = hdrpAsset.renderPipelineEditorResources.defaultSettingsVolumeProfile;
477+
string defaultSettingsVolumeProfilePath = "Assets/" + HDProjectSettings.projectSettingsFolderPath + '/' + defaultSettingsVolumeProfileInPackage.name + ".asset";
478+
479+
//try load one if one already exist
480+
VolumeProfile defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(defaultSettingsVolumeProfilePath);
481+
if (defaultSettingsVolumeProfile == null || defaultSettingsVolumeProfile.Equals(null))
482+
{
483+
//else create it
484+
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(defaultSettingsVolumeProfileInPackage), defaultSettingsVolumeProfilePath);
485+
defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(defaultSettingsVolumeProfilePath);
486+
}
487+
hdrpAsset.defaultVolumeProfile = defaultSettingsVolumeProfile;
488+
475489
EditorUtility.SetDirty(hdrpAsset);
476490
}
477491

com.unity.render-pipelines.high-definition/Editor/DefaultScene/HDWizard.Window.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public ConfigStyle(string label, string error, string button = resolve, MessageT
108108
error: "Default scene prefab must be set to create HD templated scene!");
109109
public static readonly ConfigStyle hdrpVolumeProfile = new ConfigStyle(
110110
label: "Default volume profile",
111-
error: "Default volume profile must be assigned in the HDRP asset!");
111+
error: "Default volume profile must be assigned in the HDRP asset! Also, for it to be editable, it should be outside of package.");
112112

113113
public static readonly ConfigStyle vrLegacyVRSystem = new ConfigStyle(
114114
label: "Legacy VR System",

0 commit comments

Comments
 (0)