Skip to content

Instantly share code, notes, and snippets.

@Cyanilux
Created November 28, 2021 13:03
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
// 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