///
RenderPipeline
Description
Defines a series of commands and settings that describes how Unity renders a frame.
Properties
disposed | Returns true when the RenderPipeline is invalid or destroyed. |
Protected Methods
ProcessRenderRequests | Executes RenderRequests submitted using Camera.SubmitRenderRequests. |
Render | Entry point method that defines custom rendering for this RenderPipeline. |
Static Methods
BeginCameraRendering | Calls the RenderPipelineManager.beginCameraRendering delegate. |
BeginFrameRendering | Calls the RenderPipelineManager.beginFrameRendering delegate. |
EndCameraRendering | Calls the RenderPipelineManager.endCameraRendering delegate. |
EndFrameRendering | Calls the RenderPipelineManager.endFrameRendering delegate. |
//
RenderPipeline.ProcessRenderRequests
Declaration
protected void ProcessRenderRequests(Rendering.ScriptableRenderContext context, Camera camera, List<RenderRequest> renderRequests);
Parameters
renderRequests | The list of RenderRequests to execute. |
Description
Executes RenderRequests
submitted using Camera.SubmitRenderRequests.
Unity calls this method when the user calls Camera.SubmitRenderRequests.
If the active RenderPipeline
implements this method, Unity updates the RenderTexture assigned to the results
property of each RenderRequest with the requested data.
If the active RenderPipeline
does not implement this method, Unity does nothing; it performs a no-op, and every RenderRequests remains in the same state.
If you are creating a custom Scriptable Render Pipeline you must ensure that you implement this method as described, or do not implement it.
///
RenderPipeline.Render
Declaration
protected void Render(Rendering.ScriptableRenderContext context, Camera[] cameras);
Description
Entry point method that defines custom rendering for this RenderPipeline.
This method is is the entry point to the Scriptable Render Pipeline (SRP). This functionality is not compatible with the Built-in Render Pipeline.
Unity calls this method automatically. In a standalone application, Unity calls this method once per frame to render the main view, and once per frame for each manual call to Camera.Render. In the Unity Editor, Unity calls this method once per frame for each Scene view or Game view that is visible, once per frame if if the Scene camera preview is visible, and once per frame for each manual call to Camera.Render.
If you are using the Universal Render Pipeline (URP) or the High Definition Render Pipeline (HDRP), you can use the RenderPipelineManager.beginFrameRendering, RenderPipelineManager.beginCameraRendering, RenderPipelineManager.endCameraRendering and RenderPipelineManager.endFrameRendering delegates to call your custom code at defined points during this method. If you are writing a custom SRP, you can either add code here directly, or call the delegates yourself using RenderPipeline.BeginFrameRendering, RenderPipeline.BeginCameraRendering, RenderPipeline.EndCameraRendering and RenderPipeline.EndFrameRendering.
The following example code shows how to implement this method in a custom SRP:
using UnityEngine; using UnityEngine.Rendering; using System.Collections.Generic; public class ExampleRenderPipelineInstance : RenderPipeline { public ExampleRenderPipelineInstance() { } override protected void Render(ScriptableRenderContext context, Camera[] cameras) { // This is where you can write custom rendering code. Customize this method to customize your SRP. // Create and schedule a command to clear the current render target var cmd = new CommandBuffer(); cmd.ClearRenderTarget(true, true, Color.black); context.ExecuteCommandBuffer(cmd); cmd.Release(); // Tell the Scriptable Render Context to tell the graphics API to perform the scheduled commands context.Submit(); } }
//
RenderPipelineManager.beginFrameRendering
Description
Delegate that you can use to invoke custom code at the start of RenderPipeline.Render.
When Unity calls RenderPipeline.BeginFrameRendering, it executes the methods in this delegate's invocation list.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls RenderPipeline.BeginFrameRendering automatically. If you are writing a custom Scriptable Render Pipeline and you want to use this delegate, you must add a call to RenderPipeline.BeginFrameRendering at the end of RenderPipeline.Render.
The following code example demonstrates how to add a method to this delegate's invocation list, and later remove it.
using UnityEngine; using UnityEngine.Rendering; public class ExampleClass : MonoBehaviour { void Start() { RenderPipelineManager.beginFrameRendering += OnBeginFrameRendering; } void OnBeginFrameRendering(ScriptableRenderContext context, Camera[] cameras) { // Put the code that you want to execute at the start of RenderPipeline.Render here // If you are using URP or HDRP, Unity calls this method automatically // If you are writing a custom SRP, you must call RenderPipeline.BeginFrameRendering } void OnDestroy() { RenderPipelineManager.beginFrameRendering -= OnBeginFrameRendering; } }
///
RenderPipelineManager.endFrameRendering
Description
Delegate that you can use to invoke custom code at the end of RenderPipeline.Render.
When Unity calls RenderPipeline.EndFrameRendering, it executes the methods in this delegate's invocation list.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls RenderPipeline.EndFrameRendering automatically. If you are writing a custom Scriptable Render Pipeline and you want to use this delegate, you must add a call to RenderPipeline.EndFrameRendering at the end of RenderPipeline.Render.
The following code example demonstrates how to add a method to this delegate's invocation list, and later remove it.
using UnityEngine; using UnityEngine.Rendering; public class ExampleClass : MonoBehaviour { void Start() { RenderPipelineManager.endFrameRendering += OnEndFrameRendering; } void OnEndFrameRendering(ScriptableRenderContext context, Camera[] cameras) { // Put the code that you want to execute at the end of RenderPipeline.Render here // If you are using URP or HDRP, Unity calls this method automatically // If you are writing a custom SRP, you must call RenderPipeline.EndFrameRendering } void OnDestroy() { RenderPipelineManager.endFrameRendering -= OnEndFrameRendering; } }
//
RenderPipelineManager.beginCameraRendering
Description
Delegate that you can use to invoke custom code before Unity renders an individual Camera.
When Unity calls RenderPipeline.BeginCameraRendering, it executes the methods in this delegate's invocation list.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls RenderPipeline.BeginCameraRendering automatically. If you are writing a custom Scriptable Render Pipeline and you want to use this delegate, you must add a call to RenderPipeline.BeginCameraRendering.
The following code example demonstrates how to add a method to this delegate's invocation list, and later remove it.
using UnityEngine; using UnityEngine.Rendering; public class ExampleClass : MonoBehaviour { void Start() { RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering; } void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { // Put the code that you want to execute before the camera renders here // If you are using URP or HDRP, Unity calls this method automatically // If you are writing a custom SRP, you must call RenderPipeline.BeginCameraRendering } void OnDestroy() { RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering; } }
///
RenderPipelineManager.endCameraRendering
Description
Delegate that you can use to invoke custom code after Unity renders an individual Camera.
When Unity calls RenderPipeline.EndCameraRendering, it executes the methods in this delegate's invocation list.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls RenderPipeline.EndCameraRendering automatically. If you are writing a custom Scriptable Render Pipeline and you want to use this delegate, you must add a call to RenderPipeline.EndCameraRendering.
The following code example demonstrates how to add a method to this delegate's invocation list, and later remove it.
using UnityEngine; using UnityEngine.Rendering; public class ExampleClass : MonoBehaviour { void Start() { RenderPipelineManager.endCameraRendering += OnEndCameraRendering; } void OnEndCameraRendering(ScriptableRenderContext context, Camera camera) { // Put the code that you want to execute after the camera renders here // If you are using URP or HDRP, Unity calls this method automatically // If you are writing a custom SRP, you must call RenderPipeline.EndCameraRendering } void OnDestroy() { RenderPipelineManager.endCameraRendering -= OnEndCameraRendering; } }
//
RenderPipeline.BeginCameraRendering
Declaration
protected static void BeginCameraRendering(Rendering.ScriptableRenderContext context, Camera camera);
Description
Calls the RenderPipelineManager.beginCameraRendering delegate.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls this method automatically before performing rendering operations for an individual Camera. If you are writing a custom Scriptable Render Pipeline, you can call this method manually to use the RenderPipelineManager.beginCameraRendering delegate.
The following code example demonstrates where to call this method if you are creating a custom Scriptable Render Pipeline:
using UnityEngine; using UnityEngine.Rendering; public class ExampleRenderPipelineInstance : RenderPipeline { public ExampleRenderPipelineInstance() { } override protected void Render(ScriptableRenderContext context, Camera[] cameras) { for (var i = 0; i < cameras.Length; i++) { var camera = cameras[i]; // Call the RenderPipelineManager.beginCameraRendering delegate BeginCameraRendering(context, camera); // Put your code for rendering the Camera here } } }
RenderPipeline.EndCameraRendering
Declaration
protected static void EndCameraRendering(Rendering.ScriptableRenderContext context, Camera camera);
Description
Calls the RenderPipelineManager.endCameraRendering delegate.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls this method automatically after performing rendering operations for an individual Camera. If you are writing a custom Scriptable Render Pipeline, you can call this method manually to use the RenderPipelineManager.endCameraRendering delegate.
The following code example demonstrates where to call this method if you are creating a custom Scriptable Render Pipeline:
using UnityEngine; using UnityEngine.Rendering; public class ExampleRenderPipelineInstance : RenderPipeline { public ExampleRenderPipelineInstance() { } override protected void Render(ScriptableRenderContext context, Camera[] cameras) { for (var i = 0; i < cameras.Length; i++) { var camera = cameras[i]; // Put your code for rendering the Camera here // Call the RenderPipelineManager.endCameraRendering delegate EndCameraRendering(context, camera); } } }
/
RenderPipeline.BeginFrameRendering
Declaration
protected static void BeginFrameRendering(Rendering.ScriptableRenderContext context, Camera[] cameras);
Description
Calls the RenderPipelineManager.beginFrameRendering delegate.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls this method automatically at the start of RenderPipeline.Render. If you are writing a custom Scriptable Render Pipeline, you can call this method at the start of your RenderPipeline.Render method to implement functionality using the RenderPipelineManager.beginFrameRendering delegate.
The following code example demonstrates where to call this method if you are creating a custom Scriptable Render Pipeline:
using UnityEngine; using UnityEngine.Rendering; public class ExampleRenderPipelineInstance : RenderPipeline { public ExampleRenderPipelineInstance() { } override protected void Render(ScriptableRenderContext context, Camera[] cameras) { // Call the RenderPipelineManager.beginFrameRendering delegate BeginFrameRendering(context, cameras); // Put the rest of your Render method code here } }
/
RenderPipeline.EndFrameRendering
Declaration
protected static void EndFrameRendering(Rendering.ScriptableRenderContext context, Camera[] cameras);
Description
Calls the RenderPipelineManager.endFrameRendering delegate.
In the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP), Unity calls this method automatically at the end of RenderPipeline.Render. If you are writing a custom Scriptable Render Pipeline, you can call this method at the end of RenderPipeline.Render to implement functionality using the RenderPipelineManager.endFrameRendering delegate.
The following code example demonstrates where to call this method if you are creating a custom Scriptable Render Pipeline:
using UnityEngine; using UnityEngine.Rendering; public class ExampleRenderPipelineInstance : RenderPipeline { public ExampleRenderPipelineInstance() { } override protected void Render(ScriptableRenderContext context, Camera[] cameras) { // Put the rest of your Render method code here // Call the RenderPipelineManager.endFrameRendering delegate EndFrameRendering(context, cameras); } }
//