Change RenderPipelineAsset via Script
I have implemented my own Scriptable Render Pipeline, and now I would like to add a switch to dynamically change Render Pipeline Asset via C# Script for comparison with Unity built-in Standard Shader. I searched around a lot and I couldn't find anything about changing setting in Edit -> Project Settings -> Graphics via C# Script. Can anyone point me to the right direction? Is it impossible to do so in runtime? Or is there a way to switch to the default render pipeline using my Scriptable Render Pipeline Asset?
Answer by guillemsrr · Sep 01, 2019 at 04:45 PM
In 2019.2 you can use GraphicsSettings.renderPipelineAsset = yourRPA;
How to let user set lwrp asset settings or auto configure? I want to call the values in Ui panel.
var rpAsset = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset;
var urpAsset = (UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset) rpAsset;
urpAsset.renderScale = newValue;
Ok! This is woring. :) Thanks
using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.LWRP;
public class graphicctrl : $$anonymous$$onoBehaviour { public LightweightRenderPipelineAsset assetlow; public LightweightRenderPipelineAsset assethigh;
public void ChangeQuality(float level)
{
switch((int)level)
{
case 0:
QualitySettings.SetQualityLevel(0);
GraphicsSettings.renderPipelineAsset = assetlow;
break;
case 1:
QualitySettings.SetQualityLevel(3);
GraphicsSettings.renderPipelineAsset = assethigh;
break;
}
}
}
Answer by jjxtra · Jul 03, 2019 at 03:55 PM
UnityEngine.Rendering.LWRP.LightweightRenderPipelineAsset asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Rendering.LWRP.LightweightRenderPipelineAsset>(assetPath);
As far as I can tell, render features still have to be done in inspector... dumb...
var rpAsset = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset;
var urpAsset = (UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset) rpAsset;
urpAsset.renderScale = 0.2;
Your answer
![](https://koobas.hobune.stream/wayback/20220612184352im_/https://answers.unity.com/themes/thub/images/avi.jpg)