访问自定义通行证的体积和属性。

huangapple go评论92阅读模式
英文:

Access Custom Pass Volume and its property

问题

我已在HDRP中创建了一个自定义通道体积,并且想通过脚本访问和更改其属性,我该如何做到这一点?

在下面提供的图像中,如何启用“获取颜色缓冲”?

  1. using UnityEngine.Rendering;
  2. using UnityEngine.Rendering.HighDefinition;
  3. public class AccessVolume : MonoBehaviour {
  4. public CustomPassVolume volume;
  5. void Start() {
  6. }
  7. }

CustomVolume

英文:

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" ?

  1. using UnityEngine.Rendering;
  2. using UnityEngine.Rendering.HighDefinition;
  3. public class AccessVolume: MonoBehaviour {
  4. public CustomPassVolume volume;
  5. void Start() {
  6. }
  7. }

CustomVolume

答案1

得分: 0

尝试这样做:

  1. // 获取第一个自定义通道
  2. var pass = volume.customPasses[0];
  3. // 只有 FullScreenCustomPass 类有该属性
  4. if (pass is FullScreenCustomPass full)
  5. full.fetchColorBuffer = true;
英文:

Try this:

  1. // get the first custom pass
  2. var pass = volume.customPasses[0];
  3. // only the FullScreenCustomPass class has the property
  4. if (pass is FullScreenCustomPass full)
  5. full.fetchColorBuffer = true;

huangapple
  • 本文由 发表于 2023年5月22日 17:24:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76304722.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定