- Home /
Question by
Nerizzo · Jan 03, 2020 at 11:47 PM ·
scripting problemrenderingpost processingpost-process-effectdepth of field
Modify values on VolumeProfile URP.
We are building a project where we need to modify the values of DepthOfField within VolumeProfile through script on runtime using the new URP (Universal Render Pipeline). So far we've been unsuccessfull. Is there a way to modify the value at all or is it not yet implemented. We searched for similar questions but there's not a lot out there. We would appreciate any help given to solve this matter!
Thanks in advance!
Comment
Answer by makled · Oct 22, 2020 at 12:15 AM
This was quite difficult for me as well. I managed to do this by doing the following: This was quite difficult for me as well. I managed to do this by doing the following:
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class SomeClass: MonoBehaviour
{
//Here assign the volume game object. You could also use GetComponent
public Volume volume;
private DepthOfField depthOfField = null;
public void Start()
{
volume.profile.TryGet<DepthOfField>(out depthOfField);
}
public void AccessFocalLength()
{
Debug.Log(depthOfField.focalLength.value);
}
}