英文:
Access Custom Pass Volume and its property
问题
我已在HDRP中创建了一个自定义通道体积,并且想通过脚本访问和更改其属性,我该如何做到这一点?
在下面提供的图像中,如何启用“获取颜色缓冲”?
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class AccessVolume : MonoBehaviour {
public CustomPassVolume volume;
void Start() {
}
}
英文:
I have created a custom pass volume in HDRP and I would like to access and change its properties via script, how do I do this?
In the image given below, how do I enable "Fetch Color Buffer" ?
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class AccessVolume: MonoBehaviour {
public CustomPassVolume volume;
void Start() {
}
}
答案1
得分: 0
尝试这样做:
// 获取第一个自定义通道
var pass = volume.customPasses[0];
// 只有 FullScreenCustomPass 类有该属性
if (pass is FullScreenCustomPass full)
full.fetchColorBuffer = true;
英文:
Try this:
// get the first custom pass
var pass = volume.customPasses[0];
// only the FullScreenCustomPass class has the property
if (pass is FullScreenCustomPass full)
full.fetchColorBuffer = true;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论