diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 22079a642fe..4b39297e16c 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -178,6 +178,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Changed the behavior of the clear coat and SSR/RTR for the stack lit to mimic the Lit's behavior (case 1320154). - The default LookDev volume profile is now copied and referened in the Asset folder instead of the package folder. - Changed normal used in path tracing to create a local light list from the geometric to the smooth shading one. +- Embed the HDRP config package instead of copying locally, the `Packages` folder is versionned by Collaborate. (case 1276518) ## [11.0.0] - 2020-10-21 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Known-Issues.md b/com.unity.render-pipelines.high-definition/Documentation~/Known-Issues.md index 1116abecd9c..def9298768a 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Known-Issues.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Known-Issues.md @@ -1,6 +1,6 @@ # Known issues -This page contains information on known about issues you may encounter while using HDRP. Each entry describes the issue and then details the steps to follow in order to resolve the issue. +This page contains information on known about issues you may encounter while using the High Definition Render Pipeline (HDRP). Each entry describes the issue and then details the steps to follow in order to resolve the issue. ## Material array size @@ -13,3 +13,9 @@ UnityEditor.EditorApplication:Internal_CallGlobalEventHandler() ``` To fix this issue, restart the Unity editor. + +## Working with Collaborate and a local HDRP config package + +If you installed the [config package](HDRP-Config-Package.md) locally using the [HDRP Wizard](Render-Pipeline-Wizard.md), Unity may have placed it in `LocalPackages/com.unity.render-pipelines.high-definition-config` depending on the HDRP version your project used at that time. + +In this case, Collaborate does not track changes you make to the local HDRP config package files. To fix this, move the local config package from `LocalPackages/com.unity.render-pipelines.high-definition-config` to `Packages/com.unity.render-pipelines.high-definition-config`. This embeds it in your project and allows Collaborate to tracks and version changes you make. diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs index e46cc662745..e35f55bf4c0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs @@ -1,14 +1,16 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; +using UnityEditor.PackageManager; +using UnityEditor.PackageManager.Requests; using UnityEditorInternal; using UnityEditorInternal.VR; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; +using Debug = UnityEngine.Debug; namespace UnityEditor.Rendering.HighDefinition { @@ -754,32 +756,23 @@ void FixDXRActivation(bool fromAsyncUnused) const string k_HdrpPackageName = "com.unity.render-pipelines.high-definition"; const string k_HdrpConfigPackageName = "com.unity.render-pipelines.high-definition-config"; - const string k_LocalHdrpConfigPackagePath = "LocalPackages/com.unity.render-pipelines.high-definition-config"; const string k_XRanagementPackageName = "com.unity.xr.management"; const string k_LegacyInputHelpersPackageName = "com.unity.xr.legacyinputhelpers"; - bool lastPackageConfigInstalledCheck = false; - void IsLocalConfigurationPackageInstalledAsync(Action callback) + void IsLocalConfigurationPackageEmbeddedAsync(Action callback) { - if (!Directory.Exists(k_LocalHdrpConfigPackagePath)) + WaitForRequest(PackageManager.Client.List(true, true), listRequest => { - callback?.Invoke(lastPackageConfigInstalledCheck = false); - return; - } - - m_UsedPackageRetriever.ProcessAsync( - k_HdrpConfigPackageName, - (installed, info) => + if (listRequest.Status >= StatusCode.Failure) { - // installed is not used because this one will be always installed - - DirectoryInfo directoryInfo = new DirectoryInfo(info.resolvedPath); - string recomposedPath = $"{directoryInfo.Parent.Name}{Path.DirectorySeparatorChar}{directoryInfo.Name}"; - lastPackageConfigInstalledCheck = - info.source == PackageManager.PackageSource.Local - && info.resolvedPath.EndsWith(recomposedPath); - callback?.Invoke(lastPackageConfigInstalledCheck); - }); + Debug.LogError($"Package Manager error: {listRequest.Error.message}"); + return; + } + + var packageInfo = listRequest.Result.First(info => info.name == k_HdrpConfigPackageName); + var isPackagedEmbedded = packageInfo?.source == PackageSource.Embedded; + callback?.Invoke(isPackagedEmbedded); + }); } void InstallLocalConfigurationPackage(Action onCompletion) @@ -787,59 +780,36 @@ void InstallLocalConfigurationPackage(Action onCompletion) k_HdrpConfigPackageName, (installed, info) => { - // installed is not used because this one will be always installed - - bool copyFolder = false; - if (!Directory.Exists(k_LocalHdrpConfigPackagePath)) + if (!installed) { - copyFolder = true; + Debug.LogError("The the HDRP config package is missing, please install the one with the same version of your HDRP package."); + return; } - else + + WaitForRequest(Client.Embed(info.name), embedRequest => { - if (EditorUtility.DisplayDialog("Installing local configuration package", - "A local configuration package already exists. Do you want to replace it or keep it? Replacing it may overwrite local changes you made and keeping it may make it desynchronized with the main HDRP packages version.", - "Replace", "Keep")) + if (embedRequest.Status >= StatusCode.Failure) { - Directory.Delete(k_LocalHdrpConfigPackagePath, true); - copyFolder = true; + Debug.LogError($"Failed to install the config package {embedRequest.Error.message}"); + return; } - } - - if (copyFolder) - { - CopyFolder(info.resolvedPath, k_LocalHdrpConfigPackagePath); - } - m_PackageInstaller.ProcessAsync($"file:../{k_LocalHdrpConfigPackagePath}", () => - { - lastPackageConfigInstalledCheck = true; onCompletion?.Invoke(); }); }); - void RefreshDisplayOfConfigPackageArea() + static void WaitForRequest(T request, Action onCompleted) + where T : Request { - IsLocalConfigurationPackageInstalledAsync(present => UpdateDisplayOfConfigPackageArea(present ? ConfigPackageState.Present : ConfigPackageState.Missing)); + if (request.IsCompleted) + onCompleted(request); + else + EditorApplication.delayCall += () => WaitForRequest(request, onCompleted); } - static void CopyFolder(string sourceFolder, string destFolder) + void RefreshDisplayOfConfigPackageArea() { - if (!Directory.Exists(destFolder)) - Directory.CreateDirectory(destFolder); - string[] files = Directory.GetFiles(sourceFolder); - foreach (string file in files) - { - string name = Path.GetFileName(file); - string dest = Path.Combine(destFolder, name); - File.Copy(file, dest); - } - string[] folders = Directory.GetDirectories(sourceFolder); - foreach (string folder in folders) - { - string name = Path.GetFileName(folder); - string dest = Path.Combine(destFolder, name); - CopyFolder(folder, dest); - } + IsLocalConfigurationPackageEmbeddedAsync(present => UpdateDisplayOfConfigPackageArea(present ? ConfigPackageState.Present : ConfigPackageState.Missing)); } class UsedPackageRetriever diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index 27fc814f59b..b2d1cc6399a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -34,10 +34,10 @@ static class Style public const string configurationTitle = "Configuration Checking"; public const string migrationTitle = "Project Migration Quick-links"; - public const string installConfigPackageLabel = "Install Configuration Editable Package"; - public const string installConfigPackageInfoInCheck = "Checking if the local config package is installed in your project's LocalPackage folder."; - public const string installConfigPackageInfoInProgress = "The local config package is being installed in your project's LocalPackage folder."; - public const string installConfigPackageInfoFinished = "The local config package is already installed in your project's LocalPackage folder."; + public const string installConfigPackageLabel = "Embed Configuration Editable Package"; + public const string installConfigPackageInfoInCheck = "Checking if the config package is embedded in your project."; + public const string installConfigPackageInfoInProgress = "The config package is being embedded in your project."; + public const string installConfigPackageInfoFinished = "The config package is already embedded in your project."; public const string migrateAllButton = "Convert All Built-in Materials to HDRP"; public const string migrateSelectedButton = "Convert Selected Built-in Materials to HDRP";