Click here to Skip to main content
16,022,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
changing the threshold via script not working
here is my script:
C#
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;
    }
}


What I have tried:

i tried to change it via bloom.threshold.value
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900