From 340ba1a6d1aa04bcb7ec2fcf09ae919bf4ae629e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Vauchelles?= Date: Fri, 15 May 2020 14:09:10 +0200 Subject: [PATCH 1/2] Clone in the Asset folder when the original volume profile is in a read only package. (case 1154961) --- .../Editor/Volume/VolumeEditor.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs index a9e96ed1b9d..274016aa54a 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs @@ -1,4 +1,7 @@ +using System.IO; +using UnityEditor.PackageManager; using UnityEngine; +using UnityEngine.Assertions; using UnityEngine.Rendering; namespace UnityEditor.Rendering @@ -153,7 +156,13 @@ public override void OnInspectorGUI() // Duplicate the currently assigned profile and save it as a new profile var origin = profileRef; var path = AssetDatabase.GetAssetPath(m_Profile.objectReferenceValue); - path = AssetDatabase.GenerateUniqueAssetPath(path); + + path = IsAssetInReadOnlyPackage(path) + // We may be in a read only package, in that case we need to clone the volume profile in an + // editable area, such as the root of the project. + ? AssetDatabase.GenerateUniqueAssetPath(Path.Combine("Assets", Path.GetFileName(path))) + // Otherwise, duplicate next to original asset. + : AssetDatabase.GenerateUniqueAssetPath(path); var asset = Instantiate(origin); asset.components.Clear(); @@ -202,5 +211,12 @@ public override void OnInspectorGUI() serializedObject.ApplyModifiedProperties(); } + + static bool IsAssetInReadOnlyPackage(string path) + { + Assert.IsNotNull(path); + var info = PackageManager.PackageInfo.FindForAssetPath(path); + return info != null && (info.source != PackageSource.Local && info.source != PackageSource.Embedded); + } } } From 54ade4a1bc5f6107a083e63c0b728c2e606be746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Vauchelles?= Date: Fri, 15 May 2020 14:18:06 +0200 Subject: [PATCH 2/2] Added changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 1d66f8ffd54..d6e4e1d4fe7 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -605,6 +605,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed the show cookie atlas debug mode not displaying correctly when enabling the clear cookie atlas option. - Fixed various multi-editing issues when changing Emission parameters. - Fixed error when undo a Reflection Probe removal in a prefab instance. (case 1244047) +- Cloned volume profile from read only assets are created in the root of the project. (case 1154961) ### Changed - Improve MIP selection for decals on Transparents