- Home /
Question by
WryanD · Feb 14, 2021 at 08:36 PM ·
c#scripting problempost-process-effect
What are the commands to change aspects of a vignette?
I have done searching online, and have only found out how to change float values. How do I change other aspects, such as rounded, and color? using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing;
public class PostProcessing : MonoBehaviour { public PostProcessVolume volume;
private Vignette border;
public float sniperZoom = 0.7f;
public float sniperZoomTime = 0.5f;
public float dead;
private Health health;
private ScrollWheel scroll;
void Start()
{
volume.profile.TryGetSettings(out border);
border.intensity.value = 0;
health = GameObject.FindObjectOfType<Health>();
scroll = GameObject.FindObjectOfType<ScrollWheel>();
}
void Update()
{
if (Input.GetMouseButton(1) && scroll.weaponSelect == 3 && !health.playerDead)
{
border.intensity.value = Mathf.Lerp(0, sniperZoom, sniperZoomTime);
}
else if ((!Input.GetMouseButton(1) || scroll.weaponSelect != 3) && !health.playerDead)
{
border.intensity.value = Mathf.Lerp(sniperZoom, 0, sniperZoomTime);
}
if (health.playerDead)
{
border.intensity.value = Mathf.Lerp(0, dead, 0.5f);
border.smoothness.value = 1;
border.rounded = false; //how do I set this to not rounded
}
}
}
Comment
Best Answer
Answer by Llama_w_2Ls · Feb 15, 2021 at 09:05 AM
All the properties contain values. You need to override the value property. For example:
public PostProcessVolume volume;
Vignette border;
public void EditVignette()
{
volume.profile.TryGetSettings(out border);
border.rounded.value = false;
}