This page contains information on how to get, set, and configure the render pipeline that Unity is currently using. The render pipeline that Unity is currently using is called the active render pipeline.
To render content, Unity can either use the Built-in Render Pipeline or a render pipeline based on the Scriptable Render Pipeline (SRP), which includes the Universal Render Pipeline (URP) and the High Definition Render Pipeline (HDRP).
To specify which Scriptable Render Pipeline Unity uses, you use Render Pipeline Assets. A Render Pipeline Asset tells Unity which SRP to use, and how to configure it. If you don’t specify a Render Pipeline Asset, Unity uses the Built-in Render Pipeline.
You can create multiple Render Pipeline Assets that use the same render pipeline, but with different configurations; for example, you can use different Render Pipeline Assets for different hardware quality levels. For a general introduction to Render Pipeline Assets, see Scriptable Render Pipeline introduction. For information on URP’s Render Pipeline Asset, see The Universal Render Pipeline Asset, and for HDRP’s Render Pipeline Asset, see The High Definition Render Pipeline Asset.
As soon as you change the active render pipeline in the Unity Editor or at runtime, Unity uses the new active render pipeline to render content. If you are in the Unity Editor, this includes the Game view, the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary view, and previews for Materials in the Project panel and the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary.
When you change the active render pipeline, you must ensure that the assets and code in your project are compatible with the new render pipeline; otherwise, you might experience errors or unintended visual effects.
Settings in both Graphics Settings and Quality Settings determine the active render pipeline. In Graphics Settings, you configure the render pipeline that Unity uses by default. In Quality Settings, you can override the default render pipeline for a given quality level.
To get or set the default render pipeline, use Graphics Settings > Scriptable Render Pipeline Setting (or its equivalent API, GraphicsSettings.defaultRenderPipeline). To get or set the render pipeline that overrides the default for a given quality level, Quality Settings > Render Pipeline (or its equivalent API, QualitySettings.renderPipeline).
Unity determines the active render pipeline like this:
To get the active render pipeline in the Editor UI(User Interface) Allows a user to interact with your application. More info
See in Glossary, you must check both the Graphics Settings and Quality Settings windows. For information on how to use these values to determine the active render pipeline, see Determining the active render pipeline.
To set the active render pipeline to the Built-in Render Pipeline, remove any Render Pipeline Assets from Graphics Settings and Quality Settings.
To do this:
To set the active render pipeline to one that is based on SRP, tell Unity which Render Pipeline Asset to use as the default active render pipeline, and optionally which Render Pipeline Assets to use for each quality level.
To do this:
In C# scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary, you can get and set the active render pipeline and receive a callback when the active render pipeline changes. You can do this in Edit Mode or Play Mode in the Unity Editor, or at runtime in your application.
To do this, use the following APIs:
using UnityEngine;
using UnityEngine.Rendering;
public class ActiveRenderPipelineExample : MonoBehaviour
{
// In the Inspector, assign a Render Pipeline Asset to each of these fields
public RenderPipelineAsset defaultRenderPipelineAsset;
public RenderPipelineAsset overrideRenderPipelineAsset;
void Start()
{
GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
QualitySettings.renderPipeline = overrideRenderPipelineAsset;
DisplayCurrentRenderPipeline();
}
void Update()
{
// When the user presses the left shift key, switch the default render pipeline
if (Input.GetKeyDown(KeyCode.LeftShift)) {
SwitchDefaultRenderPipeline();
DisplayCurrentRenderPipeline();
}
// When the user presses the right shift key, switch the override render pipeline
else if (Input.GetKeyDown(KeyCode.RightShift)) {
SwitchOverrideRenderPipeline();
DisplayCurrentRenderPipeline();
}
}
// Switch the default render pipeline between null,
// and the render pipeline defined in defaultRenderPipelineAsset
void SwitchDefaultRenderPipeline()
{
if (GraphicsSettings.defaultRenderPipeline == defaultRenderPipelineAsset)
{
GraphicsSettings.defaultRenderPipeline = null;
}
else
{
GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
}
}
// Switch the override render pipeline between null,
// and the render pipeline defined in overrideRenderPipelineAsset
void SwitchOverrideRenderPipeline()
{
if (QualitySettings.renderPipeline == overrideRenderPipelineAsset)
{
QualitySettings.renderPipeline = null;
}
else
{
QualitySettings.renderPipeline = overrideRenderPipelineAsset;
}
}
// Print the current render pipeline information to the console
void DisplayCurrentRenderPipeline()
{
// GraphicsSettings.defaultRenderPipeline determines the default render pipeline
// If it is null, the default is the Built-in Render Pipeline
if (GraphicsSettings.defaultRenderPipeline != null)
{
Debug.Log("The default render pipeline is defined by " + GraphicsSettings.defaultRenderPipeline.name);
}
else
{
Debug.Log("The default render pipeline is the Built-in Render Pipeline");
}
// QualitySettings.renderPipeline determines the override render pipeline for the current quality level
// If it is null, no override exists for the current quality level
if (QualitySettings.renderPipeline != null)
{
Debug.Log("The override render pipeline for the current quality level is defined by " + QualitySettings.renderPipeline.name);
}
else
{
Debug.Log("No override render pipeline exists for the current quality level");
}
// If the default render pipeline is the Built-in Render Pipeline, Unity always uses that.
// Otherwise, if an override render pipeline is defined, Unity uses that.
// If an override render pipeline is not defined, it falls back to the default value
if (GraphicsSettings.defaultRenderPipeline == null)
{
Debug.Log("The active render pipeline is the default render pipeline");
}
else if (QualitySettings.renderPipeline != null)
{
Debug.Log("The active render pipeline is the override render pipeline");
}
else
{
Debug.Log("The active render pipeline is the default render pipeline");
}
// To get a reference to the Render Pipeline Asset that defines the active render pipeline,
// without knowing if it is the default or an override, use GraphicsSettings.currentRenderPipeline
if (GraphicsSettings.currentRenderPipeline != null)
{
Debug.Log("The active render pipeline is defined by " + GraphicsSettings.currentRenderPipeline.name);
}
else
{
Debug.Log("The active render pipeline is the Built-in Render Pipeline");
}
}
}