Skip to content

Clone in the Asset folder when the original volume profile is in a re… #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.IO;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
}
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 @@ -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
Expand Down