public static Configuration CheckPackageInstallation() { IS_INSTALLED = false; Config = Configuration.Auto; if (PackageManager.packages == null) { PackageManager.RetreivePackageList(); } foreach (UnityEditor.PackageManager.PackageInfo p in PackageManager.packages) { if (p.name == PACKAGE_ID) { PPS_VERSION = p.version.Replace("-preview", string.Empty); LATEST_COMPATIBLE_VERSION = p.versions.latestCompatible; //Validate installed version against compatible range System.Version curVersion = new System.Version(PPS_VERSION); System.Version minVersion = new System.Version(MIN_PPS_VERSION); System.Version maxVersion = new System.Version(MAX_PPS_VERSION); System.Version latestVersion = new System.Version(LATEST_COMPATIBLE_VERSION); //Clamp to maximum compatible version if (latestVersion > maxVersion) { latestVersion = maxVersion; } if (curVersion >= minVersion && curVersion <= maxVersion) { PPSVersionStatus = VersionStatus.Compatible; } if (curVersion < minVersion || curVersion < latestVersion) { PPSVersionStatus = VersionStatus.Outdated; } if (curVersion < minVersion || curVersion > maxVersion) { PPSVersionStatus = VersionStatus.InCompatible; } #if SCPE_DEV Debug.Log("<b>CheckPPSInstallation</b> PPS version " + p.version + " Installed. Required: " + MIN_PPS_VERSION); #endif IS_INSTALLED = true; Config = Configuration.PackageManager; } } //PPS not installed if (IS_INSTALLED == false) { #if UNITY_2019_3_OR_NEWER //URP is available and has integrated PP if (RenderPipelineInstallation.CurrentPipeline == RenderPipelineInstallation.Pipeline.URP && RenderPipelineInstallation.VersionStatus == RenderPipelineInstallation.Version.Compatible) { IS_INSTALLED = true; Config = Configuration.Integrated; PPSVersionStatus = VersionStatus.Compatible; #if SCPE_DEV Debug.Log("<b>CheckPPSInstallation</b> URP installed, integrated PP available"); #endif } #else //On older versions, fetch latest compatible PSS package UnityEditor.PackageManager.Requests.SearchRequest r = Client.Search(PACKAGE_ID); while (r.Status == StatusCode.InProgress) { //Waiting } if (r.IsCompleted) { LATEST_COMPATIBLE_VERSION = r.Result[0].versions.latestCompatible; //Clamp to maximum compatible version System.Version maxVersion = new System.Version(MAX_PPS_VERSION); System.Version latestVersion = new System.Version(LATEST_COMPATIBLE_VERSION); if (latestVersion > maxVersion) { LATEST_COMPATIBLE_VERSION = MAX_PPS_VERSION; } } #endif } #if SCPE_DEV if (IS_INSTALLED) { Debug.Log("<b>PostProcessingInstallation</b> " + Config + " version is installed"); } else { Debug.Log("<b>PostProcessingInstallation</b> Post Processing Stack is not installed"); } #endif return(Config); }