In the Scriptable Render Pipeline (SRP), your Project must have an active Render Pipeline Asset. This page contains information on setting the Render Pipeline Asset for your Project, in the Unity Editor and at runtime.
Because SRP is highly configurable, changing the active Render Pipeline Asset can result in a very minor change, such using the same Render Pipeline Instance with a different quality tier, or a very large change, such as switching from the Universal Render Pipeline (URP) to the High Definition Render Pipeline (HDRP).
If you change the active Render Pipeline Asset to one that uses a different Render Pipeline Instance, you must ensure that the assets and code in your Project are compatible with the new Render Pipeline Instance. Otherwise, you might experience errors or unintended visual effects.
Also note that swapping to a new Render Pipeline Asset causes Unity to destroy the current Render Pipeline Instance, and call the new Render Pipeline Asset’s CreatePipeline()
method. Depending on the code in your SRP, this might be a computationally resource-intensive operation.
You need to set a Render Pipeline Asset in the Unity Editor so that you can work with SRP while you edit your Project. The Render Pipeline Asset that you set in the Editor is the one that Unity uses by default in the built player.
Set the Render Pipeline Asset for your Project in the Graphics Settings window.
You can set the Render Pipeline Asset at runtime if you want to switch between Render Pipeline Assets. You can do this in the built player, or in Play Mode in the Editor.
At runtime, set the Render Pipeline Asset using the GraphicsSettings.renderPipelineAsset API.
The following example code shows how to switch between two Render Pipeline Assets.
using UnityEngine;
using UnityEngine.Rendering;
public class SwitchRenderPipelineAsset : MonoBehaviour
{
public RenderPipelineAsset exampleAssetA;
public RenderPipelineAsset exampleAssetB;
void Update()
{
if (Input.GetKeyDown(KeyCode.A)) {
GraphicsSettings.renderPipelineAsset = exampleAssetA;
Debug.Log("Active render pipeline asset is: " + GraphicsSettings.renderPipelineAsset.name);
}
else if (Input.GetKeyDown(KeyCode.B)) {
GraphicsSettings.renderPipelineAsset = exampleAssetB;
Debug.Log("Active render pipeline asset is: " + GraphicsSettings.renderPipelineAsset.name);
}
}