Hello, I’m having an issue. I change the vignette color through the script, and a bug occurs. The screen becomes very bright and doesn’t display the intended color.
Here is the script:
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class Player : MonoBehaviour
{
public float speed;
[SerializeField] private float jumpForce;
private Rigidbody2D rig;
private Animator anim;
[SerializeField] private Volume postProcessing;
[SerializeField] private Vignette V;
// Start is called before the first frame update
void Start()
{
rig = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
postProcessing.profile.TryGet(out V);
}
// Update is called once per frame
void FixedUpdate()
{
Movement();
}
private void Update()
{
}
void Movement()
{
if (Input.GetKey(KeyCode.LeftControl))
{
speed = 65f;
V.color.value = new Color(13, 15, 46);
V.intensity.value = 0.543f;
}
else
{
speed = 140f;
V.color.value = new Color(60, 61, 70);
V.intensity.value = 0.258f;
}
}
}