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); + } } } diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 346820eb7df..8457eea63c0 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -615,6 +615,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed the light overlap scene view draw mode (wasn't working at all). - Fixed taaFrameIndex and XR tests 4052 and 4053 - Fixed the prefab integration of custom passes (Prefab Override Highlight not working as expected). +- 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