Question by
AugustInSitu · Jul 03, 2016 at 12:07 PM ·
coroutinetimetimermathf.clamp
Need coroutine to render a texture value clamped from 0 to 1 over time
I want to know how to have a texture change values in order to play an animation of sorts through a coroutine. The current code I have is here:
IEnumerator Transition()
{
float cutoff = Mathf.Clamp(Time.time, 0, 1.0f); //need to find out how to make the animation play over time
rend.sharedMaterial.SetFloat("_Cutoff", cutoff);
yield return null;
}
I have clamped the values between 0 and 1, but I'm unsure on how to use the "time" function to get the result I'm looking for. Thanks in advance.
Comment
Best Answer
Answer by NoseKills · Jul 03, 2016 at 03:57 PM
Your problem is almost exactly the same as in this question
Concentrate on the IEnumerator in the answer. That's one way to make something happen over x seconds. Just delete the parts you don't need in the IEnumerator.
Your answer
Follow this Question
Related Questions
Timed button pressed C# 1 Answer
How to shake the virtual camera when time scale is 0? 0 Answers
20 minute countdown timer 2 Answers