I’m trying to control Threshold/Intensity for the Bloom override on a Volume object from a script in 2019.3.10f1. Here’s what I’ve got:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
public class MainMenuFlicker: MonoBehaviour
{
Volume volume;
Bloom bloom;
void Start()
{
volume = gameObject.GetComponent<Volume>();
Bloom tmp;
if (volume.profile.TryGet<Bloom>(out tmp))
{
bloom = tmp;
}
}
void Update()
{
}
}
This gives me the error: Assets\Scripts\MainMenuFlicker.cs(16,28): error CS0311: The type 'UnityEngine.Rendering.PostProcessing.Bloom' cannot be used as type parameter 'T' in the generic type or method 'VolumeProfile.TryGet<T>(out T)'. There is no implicit reference conversion from 'UnityEngine.Rendering.PostProcessing.Bloom' to 'UnityEngine.Rendering.VolumeComponent'.
Looking around online, it seems like this part of the API is changing pretty rapidly (e.g. different required using
statements), and I can’t figure out how to correctly TryGet the Bloom from my Volume.