- Home /
Question by
StativKaktus131 · Aug 05, 2020 at 01:07 PM ·
c#camerapost processingpost-process-effectpostprocess
How to change the color of a vignette?
So, I am using Post Processing to create a vignette for my game. Now I want to have a speed effect, so when I collect a potion, it turns the vignette green or something. to do this, I use the code: using UnityEngine; using System.Collections; using UnityEngine.Rendering.PostProcessing;
public class ControlPostProcessing : MonoBehaviour
{
public PostProcessVolume vol;
public ColorParameter vignetterColor;
public Vignette vignette;
void Start()
{
vignetterColor.value = new Color(0f, 0f, 0f);
vol.profile.TryGetSettings(out vignette);
}
void Update()
{
vignette.color = vignetterColor;
if(Input.GetKey(KeyCode.JoystickButton3)) StartCoroutine(SpeedEffect());
}
IEnumerator SpeedEffect()
{
vignetterColor.value = new Color(0f, 1f, 0f);
yield return new WaitForSeconds(10);
vignetterColor.value = new Color(0f, 0f, 0f);
}
}
This works, or rather in the inspector I see that it changes the vignette's color. Although, it always disables the color. While in the scene:
while playing:
Comment