public static void EnableLightweightPipeline() { if (!WeatherMakerEditorUtility.TypeExists("UnityEngine.Rendering.LWRP.LightweightRenderPipeline")) { UnityEditor.EditorUtility.DisplayDialog("Error", "Please import LWRP package first, latest 5.X version supported.", "OK"); return; } string[] packageGuids = AssetDatabase.FindAssets("WeatherMakerLWRPPackage"); if (packageGuids.Length != 1) { UnityEditor.EditorUtility.DisplayDialog("Error", "Missing WeatherMakerLWRPPackage.unitypackage file, please re-download from asset store", "OK"); return; } WeatherMakerEditorUtility.ReplaceGrabPassInAllShaders(false); WeatherMakerEditorUtility.UpdatePreProcessor(true, "UNITY_LWRP"); AssetDatabase.ImportPackage(AssetDatabase.GUIDToAssetPath(packageGuids[0]), true); }
private static void EnableURPInternal(string type, string profile, string importErrorText, string profileErrorText, string renderFeatureText) { if (!WeatherMakerEditorUtility.TypeExists(type)) { UnityEditor.EditorUtility.DisplayDialog("Error", importErrorText, "OK"); return; } string[] guids = AssetDatabase.FindAssets(profile); if (guids.Length == 0) { UnityEditor.EditorUtility.DisplayDialog("Error", profileErrorText, "OK"); return; } WeatherMakerEditorUtility.ReplaceGrabPassInAllShaders(false); WeatherMakerEditorUtility.UpdatePreProcessor(true, "UNITY_URP"); string assetPath = AssetDatabase.GUIDToAssetPath(guids[0]); RenderPipelineAsset pipeline = AssetDatabase.LoadAssetAtPath <RenderPipelineAsset>(assetPath); UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = pipeline; UnityEditor.EditorUtility.DisplayDialog("Notice", renderFeatureText, "OK"); }