Created
November 28, 2021 13:03
-
-
Save Cyanilux/8fb3353529887e4184159841b8cad208 to your computer and use it in GitHub Desktop.
Possible workaround for the 2D Renderers not allowing you to assign Renderer Features
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Possible workaround for the 2D Renderers not allowing you to assign Renderer Features yet. | |
// Enqueues a ScriptableRenderPass without relying on a Renderer Feature | |
// Used with https://github.com/Cyanilux/URP_BlitRenderFeature/blob/master/Blit.cs | |
public class Renderer2DBlitTest : MonoBehaviour { | |
public Blit.BlitSettings settings; | |
private Blit.BlitPass blitPass; | |
private void OnEnable(){ | |
blitPass = new Blit.BlitPass(settings.Event, settings, "BlitTest"); | |
RenderPipelineManager.beginCameraRendering += Test; | |
} | |
private void OnDisable(){ | |
RenderPipelineManager.beginCameraRendering -= Test; | |
} | |
private void Test(ScriptableRenderContext context, Camera camera) { | |
blitPass.Setup("_CameraColorTexture", "_CameraColorTexture"); | |
camera.GetUniversalAdditionalCameraData().scriptableRenderer.EnqueuePass(blitPass); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment