Advertisement
Guest User

Unity - Animated alpha coroutine

a guest
Mar 24th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. private IEnumerator AnimateRevealing()
  2. {
  3.   renderer.enabled = true;
  4.   var color = renderer.material.color;
  5.   for(var time = 0; time < duration; time += Time.deltaTime)
  6.   {
  7.     color.a = time / duration;
  8.     renderer.material.color = color;
  9.     yield return null;
  10.   }
  11.   color.a = 1;
  12.   renderer.material.color = color;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement