Skip to content

Commit

Permalink
fix: compile error in UniversalRP 16 (Unity 2023.2)
Browse files Browse the repository at this point in the history
close #206
  • Loading branch information
mob-sakai committed Oct 31, 2024
1 parent 20a581b commit f03826f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Runtime/Coffee.SoftMaskForUGUI.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
Expand Down
16 changes: 14 additions & 2 deletions Runtime/SoftMaskableShaderGraphSupportFeature.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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<Data>("SoftMaskableShaderGraphSupport", out var d))
{
#if UNITY_6000_0_OR_NEWER
var cam = frameData.Get<UniversalCameraData>();
d.isGameView = cam.cameraType == CameraType.Game;
#else
d.isGameView = renderingData.cameraData.cameraType == CameraType.Game;
#endif
builder.AllowPassCulling(false);
builder.AllowGlobalStateModification(true);
builder.SetRenderFunc<Data>((x, context) =>
Expand Down

0 comments on commit f03826f

Please sign in to comment.