public IEnumerator FadeIn(float time)
{
Color color = image.color;
while (color.a > 0f)
{
color.a -= Time.deltaTime / time;
image.color = color;
yield return null;
}
}
public IEnumerator FadeOut(float time)
{
Color color = image.color;
while (color.a < 1f)
{
color.a += Time.deltaTime / time;
image.color = color;
yield return null;
}
}
'Unity' 카테고리의 다른 글
[Unity/Event] 변수 변경시 정해진 이벤트 호출하기 (0) | 2020.10.19 |
---|---|
[Unity] Generic DontDestroyOnLoad (0) | 2020.10.05 |
[Unity] Generic Singleton (0) | 2020.10.05 |
[Unity/UI] 유저가 정해진 버튼만 클릭할 수 있게 하기 (0) | 2020.08.26 |
[Unity/UI] RectTransform 정리 (0) | 2020.08.26 |