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

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

Access Custom Pass Volume and its property

问题

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

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

using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

public class AccessVolume : MonoBehaviour {

    public CustomPassVolume volume;

    void Start() {

    }

}

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

using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
 
public class AccessVolume: MonoBehaviour {
 
public CustomPassVolume volume;
 
  void Start() {
 
  }
 
}

CustomVolume

答案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;

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:

确定