创建渲染管线
为你的工程设置渲染管线资源
Edit > Project Settings > Graphics来打开 Graphics Settings窗口
设置渲染管线
在runtime时,使用 GraphicsSettings.renderPipelineAsset API对渲染管线资源进行设置
以下的代码展示了如何在多个渲染管线资源之间切换.
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);
}
}
}