This question was
closed Jul 25, 2020 at 12:21 AM by
ramkhilnani for the following reason:
Got help on stackoverflow instead.
Question by
ramkhilnani · Jul 23, 2020 at 03:45 AM ·
shadersprogramminglerpfloat
How do I change a Shader Graph's property (float) over time?
As seen below, i created a shader effect and added a Vector1 property called "Visibility", where if set to 1 nothing happens but as it progresses to 0 the shader effect comes into play and becomes visible.
My issue is finding a way to reduce the 'Visibility' property from 1 to 0 over time. I know how to change the value of the 'Visibility' property through code using SetFloat, like this:
if (door.GetComponent<MeshRenderer>().material = changeDisolve)
{
changeDisolve.SetFloat("Visibility", 0.0f);
}
But i want the value to progress to 0 via a 'duration', so i tried using Mathf.Lerp as seen below-which did not work either:
if (door.GetComponent<MeshRenderer>().material = changeDisolve)
{
float changeVisibility = Mathf.Lerp(1f, 0f, 3f);
changeDisolve.SetFloat("Visibility", changeVisibility);
}
Does anyone know what i am doing wrong or how to go about this? Thanks in advance.
capture.jpg
(160.0 kB)
capture1.jpg
(181.8 kB)
Comment