public static void EnableStandardPipeline() { UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = null; WeatherMakerEditorUtility.ReplaceGrabPassInAllShaders(true); WeatherMakerEditorUtility.UpdatePreProcessor(false, "UNITY_URP"); WeatherMakerEditorUtility.UpdatePreProcessor(false, "UNITY_HDRP"); AssetDatabase.Refresh(); UnityEditor.EditorUtility.DisplayDialog("Success", "Standard pipeline enabled", "OK"); }
private static void DidReloadScripts() { // executes on first load or whenever code finishes compiling CleanupOldFiles(); UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); bool hasWeatherMaker = false; bool hasPostProcessV2 = false; bool hasPlaymaker = false; bool hasMirror = false; bool hasCts = false; bool hasCrest = false; foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type type in a.GetTypes()) { switch (type.FullName.ToLowerInvariant()) { case "digitalruby.weathermaker.weathermakerscript": hasWeatherMaker = true; break; case "unityengine.rendering.postprocessing.postprocesslayer": hasPostProcessV2 = true; break; case "hutonggames.playmaker.fsmprocessor": hasPlaymaker = true; break; case "mirror.networkidentity": hasMirror = true; break; case "cts.completeterrainshader": hasCts = true; break; case "crest.oceanrenderer": hasCrest = true; break; } } } WeatherMakerEditorUtility.UpdatePreProcessor(hasWeatherMaker, "WEATHER_MAKER_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasPostProcessV2, "UNITY_POST_PROCESSING_STACK_V2"); WeatherMakerEditorUtility.UpdatePreProcessor(hasPlaymaker, "PLAYMAKER_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasMirror, "MIRROR_NETWORKING_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasCts, "CTS_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasCrest, "CREST_OCEAN_PRESENT"); }
public static void EnableStandardPipeline() { UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = null; string[] guids = AssetDatabase.FindAssets("WeatherMakerPrefab"); if (guids.Length != 0) { string path = Path.GetDirectoryName(AssetDatabase.GUIDToAssetPath(guids[0])); path = Path.Combine(path, "ScriptableRenderPipeline"); UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = null; FileUtil.DeleteFileOrDirectory(path); } WeatherMakerEditorUtility.ReplaceGrabPassInAllShaders(true); WeatherMakerEditorUtility.UpdatePreProcessor(false, "UNITY_LWRP"); //WeatherMakerEditorUtility.UpdatePreProcessor(false, "UNITY_HDRP"); AssetDatabase.Refresh(); UnityEditor.EditorUtility.DisplayDialog("Success", "Standard pipeline enabled", "OK"); }
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"); }
private static void DidReloadScripts() { // executes on first load or whenever code finishes compiling CleanupOldFiles(); UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); bool hasWeatherMaker = false; bool hasPostProcessV2 = false; bool hasPlaymaker = false; bool hasCts = false; bool hasCrest = false; foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { // check for any assemblies that obviously won't have the // types we care about and skip them. Some of these assemblies // will throw a ReflectionTypeLoadException if we try to read // their types. One example being: // Microsoft.CodeAnalysis.Scripting, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3 string assemblyName = a.GetName().Name; if (assemblyName.StartsWith("System.", StringComparison.OrdinalIgnoreCase) || assemblyName.StartsWith("Microsoft.", StringComparison.OrdinalIgnoreCase) || assemblyName.StartsWith("Mono.", StringComparison.OrdinalIgnoreCase)) { continue; } try { foreach (Type type in a.GetTypes()) { switch (type.FullName.ToLowerInvariant()) { case "digitalruby.weathermaker.weathermakerscript": hasWeatherMaker = true; break; case "unityengine.rendering.postprocessing.postprocesslayer": hasPostProcessV2 = true; break; case "hutonggames.playmaker.fsmprocessor": hasPlaymaker = true; break; case "cts.completeterrainshader": hasCts = true; break; case "crest.oceanrenderer": hasCrest = true; break; } } } catch (ReflectionTypeLoadException e) { Debug.LogErrorFormat("Could not read types on assembly {0}", a.FullName); Debug.LogException(e); } } WeatherMakerEditorUtility.UpdatePreProcessor(hasWeatherMaker, "WEATHER_MAKER_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasPostProcessV2, "UNITY_POST_PROCESSING_STACK_V2"); WeatherMakerEditorUtility.UpdatePreProcessor(hasPlaymaker, "PLAYMAKER_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasCts, "CTS_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(hasCrest, "CREST_OCEAN_PRESENT"); WeatherMakerEditorUtility.UpdatePreProcessor(false, "UNITY_LWRP", "UNITY_URP"); }