Skip to content

Commit

Permalink
Hd/fix wizard defaultvolumeprofile creation #565
Browse files Browse the repository at this point in the history
  • Loading branch information
RSlysz authored and sebastienlagarde committed Jul 7, 2020
1 parent 0e9793d commit 8b84ee2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
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 @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue that prevented cubemap thumbnails from rendering (only on D3D11 and Metal).
- Fixed Microshadow not working correctly in deferred with LightLayers
- Tentative fix for missing include in depth of field shaders.
- Fixed Wizard check on default volume profile to also check it is not the default one in package.

### Changed
- Shadowmask and realtime reflection probe property are hide in Quality settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ bool IsDefaultVolumeProfileAssigned()
return false;

var hdAsset = HDRenderPipeline.currentAsset;
return hdAsset.defaultVolumeProfile != null && !hdAsset.defaultVolumeProfile.Equals(null);
return hdAsset.defaultVolumeProfile != null
&& !hdAsset.defaultVolumeProfile.Equals(null)
&& hdAsset.defaultVolumeProfile != hdAsset.renderPipelineEditorResources.defaultSettingsVolumeProfile;
}
void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
{
Expand All @@ -471,7 +473,19 @@ void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
if (hdrpAsset == null)
return;

EditorDefaultSettings.GetOrAssignDefaultVolumeProfile(hdrpAsset);
VolumeProfile defaultSettingsVolumeProfileInPackage = hdrpAsset.renderPipelineEditorResources.defaultSettingsVolumeProfile;
string defaultSettingsVolumeProfilePath = "Assets/" + HDProjectSettings.projectSettingsFolderPath + '/' + defaultSettingsVolumeProfileInPackage.name + ".asset";

//try load one if one already exist
VolumeProfile defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(defaultSettingsVolumeProfilePath);
if (defaultSettingsVolumeProfile == null || defaultSettingsVolumeProfile.Equals(null))
{
//else create it
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(defaultSettingsVolumeProfileInPackage), defaultSettingsVolumeProfilePath);
defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(defaultSettingsVolumeProfilePath);
}
hdrpAsset.defaultVolumeProfile = defaultSettingsVolumeProfile;

EditorUtility.SetDirty(hdrpAsset);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public ConfigStyle(string label, string error, string button = resolve, MessageT
error: "Default scene prefab must be set to create HD templated scene!");
public static readonly ConfigStyle hdrpVolumeProfile = new ConfigStyle(
label: "Default volume profile",
error: "Default volume profile must be assigned in the HDRP asset!");
error: "Default volume profile must be assigned in the HDRP asset! Also, for it to be editable, it should be outside of package.");

public static readonly ConfigStyle vrLegacyVRSystem = new ConfigStyle(
label: "Legacy VR System",
Expand Down

0 comments on commit 8b84ee2

Please sign in to comment.