- Home /
Can't change Post processing value from script with HDRP keep getting a TrygetSettings error
I want to animate some post-processing effects after a huge explosion in my game. First I tried to animate the post-processing volume values within a timeline animation, but I soon figured out that is not possible. Now I'm trying to code the animation but for some reason, this code is not working: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing;
public class NukePostProcessing : MonoBehaviour
{
public PostProcessVolume volume;
Bloom bloom;
// Start is called before the first frame update
void Start()
{
volume.profile.TryGetSettings(out bloom);
}
// Update is called once per frame
void Update()
{
}
}
The error that I keep getting occurs at the "TryGetSettings" part. Here is the error:
error CS0311: The type 'Bloom' cannot be used as type parameter 'T' in the generic type or method 'PostProcessProfile.TryGetSettings(out T)'. There is no implicit reference conversion from 'Bloom' to 'UnityEngine.Rendering.PostProcessing.PostProcessEffectSettings'.
I have spent hours now researching how post-processing scripting works and from everything, I was able to find my code should work and I don't understand why it doesn't. I hope someone can help me out and I thank you in advance for your help :)
I've never tried scripting Post processing effects in HDRP. All I know is how to do it from the post processing stack from the asset store. Have you tried this line? It's a bit less implicit volume.profile.TryGetSettings<Bloom>(out bloom);