- Home /
How do You Edit Post-Processing Through Script in The Latest Version of Unity?
I know there are a lot of Questions already asked about this, but they all use unity 2018 or earlier and the code does not work anymore (header files don't exist, variable types either, etc.) and they don't even explain how it works.
Could somebody please give a clear, up-to-date explanation on how to edit post-processing through script in the latest version of Unity? Thanks In advance! (USING URP BTW)
(for anyone curious on what the OLD code was, this is the gist of it):
using UnityEngine.Rendering.PostProcessing;
using UnityEngine;
public class VisualsManager : MonoBehaviour
{
public PostProcessVolume volume;
private Bloom _Bloom;
void Start()
{
volume.profile.TryGetSettings(out _Bloom);
_Bloom.intensity.value = 0;
}
}
Answer by Llama_w_2Ls · Jul 23, 2020 at 03:28 PM
public PostProcessVolume volume;
public float BloomIntensityValue;
public void Update()
{
ChangeBloomIntensitySettings();
}
public void ChangeBloomIntensitySettings()
{
GameObject gameObject = GameObject.Find("Coloured Cubes"); //Finds the gameobject with the post process volume on it
volume = gameObject.GetComponent<PostProcessVolume>(); //Sets the public variable volume to that gameobject's volume component
Bloom bloom; //Accesses class 'bloom'
volume.profile.TryGetSettings(out bloom); //Get settings
bloom.intensity.value = BloomIntensityValue; //set the intensity to the public float 'bloomintensityvalue'
}
NGL this took a looong time to find
Btw, you need the post process package from the package manager to access these classes, for anyone else following this thread.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can i prevent from mouse to collide with thirdpersoncontroller ? 0 Answers
How can I get an offline reward? 0 Answers
Brackeys EnemyAi Script 0 Answers