changing the threshold of bloom via script not working
here is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
public class SlowMotion1 : MonoBehaviour
{
[SerializeField] private Volume volume;
public float slowMotionTimescale;
private float startTimescale;
private float startFixedDeltaTime;
void Start()
{
startTimescale = Time.timeScale;
startFixedDeltaTime = Time.fixedDeltaTime;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
StartSlowMotion();
if (volume.profile.TryGet(out Bloom bloom))
{
bloom.intensity.value = 0.2f;
bloom.threshold.value = 10f;
}
}
if (Input.GetKeyUp(KeyCode.E))
{
StopSlowMotion();
if (volume.profile.TryGet(out Bloom bloom))
{
bloom.intensity.value = 1f;
bloom.threshold.value = 0.72f;
}
}
}
private void StartSlowMotion()
{
Time.timeScale = slowMotionTimescale;
Time.fixedDeltaTime = startFixedDeltaTime * slowMotionTimescale;
}
private void StopSlowMotion()
{
Time.timeScale = startTimescale;
Time.fixedDeltaTime = startFixedDeltaTime;
}
}