From 80413fc4473f3ccf76e34a43b2a09267f0fd2f4c Mon Sep 17 00:00:00 2001 From: mob-sakai <12690315+mob-sakai@users.noreply.github.com> Date: Thu, 31 Oct 2024 09:44:52 +0900 Subject: [PATCH] fix: compile error in UniversalRP 16 (Unity 2023.2) close #206 --- .../src/Runtime/Coffee.SoftMaskForUGUI.asmdef | 6 +++--- .../SoftMaskableShaderGraphSupportFeature.cs | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Packages/src/Runtime/Coffee.SoftMaskForUGUI.asmdef b/Packages/src/Runtime/Coffee.SoftMaskForUGUI.asmdef index cb32f6e..73f0976 100644 --- a/Packages/src/Runtime/Coffee.SoftMaskForUGUI.asmdef +++ b/Packages/src/Runtime/Coffee.SoftMaskForUGUI.asmdef @@ -25,12 +25,12 @@ }, { "name": "com.unity.render-pipelines.universal", - "expression": "16", - "define": "SHADERGRAPH_ENABLE" + "expression": "16.0.0", + "define": "SHADERGRAPH_CANVAS_ENABLE" }, { "name": "com.unity.render-pipelines.universal", - "expression": "1", + "expression": "1.0.0", "define": "URP_ENABLE" } ] diff --git a/Packages/src/Runtime/SoftMaskableShaderGraphSupportFeature.cs b/Packages/src/Runtime/SoftMaskableShaderGraphSupportFeature.cs index 1bcda94..0c8e91a 100644 --- a/Packages/src/Runtime/SoftMaskableShaderGraphSupportFeature.cs +++ b/Packages/src/Runtime/SoftMaskableShaderGraphSupportFeature.cs @@ -1,9 +1,13 @@ -#if SHADERGRAPH_ENABLE +#if SHADERGRAPH_CANVAS_ENABLE using System; using UnityEngine; using UnityEngine.Rendering; -using UnityEngine.Rendering.RenderGraphModule; using UnityEngine.Rendering.Universal; +#if UNITY_6000_0_OR_NEWER +using UnityEngine.Rendering.RenderGraphModule; +#else +using UnityEngine.Experimental.Rendering.RenderGraphModule; +#endif namespace Coffee.UISoftMask { @@ -23,12 +27,20 @@ private class Data public bool isGameView; } +#if UNITY_6000_0_OR_NEWER public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) +#else + public override void RecordRenderGraph(RenderGraph renderGraph, FrameResources frameResources, ref RenderingData renderingData) +#endif { using (var builder = renderGraph.AddRasterRenderPass("SoftMaskableShaderGraphSupport", out var d)) { +#if UNITY_6000_0_OR_NEWER var cam = frameData.Get(); d.isGameView = cam.cameraType == CameraType.Game; +#else + d.isGameView = renderingData.cameraData.cameraType == CameraType.Game; +#endif builder.AllowPassCulling(false); builder.AllowGlobalStateModification(true); builder.SetRenderFunc((x, context) =>