Skip to content

Commit 1ffe291

Browse files
fredericv-unity3dsebastienlagarde
authored andcommitted
Clone in the Asset folder when the original volume profile is in a re… #508
1 parent 9174314 commit 1ffe291

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
using System.IO;
2+
using UnityEditor.PackageManager;
13
using UnityEngine;
4+
using UnityEngine.Assertions;
25
using UnityEngine.Rendering;
36

47
namespace UnityEditor.Rendering
@@ -153,7 +156,13 @@ public override void OnInspectorGUI()
153156
// Duplicate the currently assigned profile and save it as a new profile
154157
var origin = profileRef;
155158
var path = AssetDatabase.GetAssetPath(m_Profile.objectReferenceValue);
156-
path = AssetDatabase.GenerateUniqueAssetPath(path);
159+
160+
path = IsAssetInReadOnlyPackage(path)
161+
// We may be in a read only package, in that case we need to clone the volume profile in an
162+
// editable area, such as the root of the project.
163+
? AssetDatabase.GenerateUniqueAssetPath(Path.Combine("Assets", Path.GetFileName(path)))
164+
// Otherwise, duplicate next to original asset.
165+
: AssetDatabase.GenerateUniqueAssetPath(path);
157166

158167
var asset = Instantiate(origin);
159168
asset.components.Clear();
@@ -202,5 +211,12 @@ public override void OnInspectorGUI()
202211

203212
serializedObject.ApplyModifiedProperties();
204213
}
214+
215+
static bool IsAssetInReadOnlyPackage(string path)
216+
{
217+
Assert.IsNotNull(path);
218+
var info = PackageManager.PackageInfo.FindForAssetPath(path);
219+
return info != null && (info.source != PackageSource.Local && info.source != PackageSource.Embedded);
220+
}
205221
}
206222
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9191
- Fixed Microshadow not working correctly in deferred with LightLayers
9292
- Tentative fix for missing include in depth of field shaders.
9393
- Fix an issue in reading the gbuffer for ray traced subsurface scattering (case 1248358).
94+
- Cloned volume profile from read only assets are created in the root of the project. (case 1154961)
9495

9596
### Changed
9697
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

0 commit comments

Comments
 (0)