-
[UI] 이미지를 이용한 페이드 아웃Unity(유니티) 2022. 8. 31. 09:31
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Fade : MonoBehaviour { public UnityEngine.UI.Image fade; float fades = 0.1f; float time = 0.0f; // Update is called once per frame void Update() { time += Time.deltaTime; if (fades < 1.0f && time >= 0.1f) { fades += 0.02f; fade.color = new Color(0, 0, 0, fades); time = 0; } } }
UI 이미지를 삽입하고 deltaTime 값에 비례하게 알파값을 조절하여 fade in, out 효과를 줄 수 있다.
'Unity(유니티)' 카테고리의 다른 글
[3D] Random Range Spawn (0) 2022.07.18 [3D]Destroy out of Bounds (0) 2022.07.18 [3D] 오브젝트 회전 (Mathf.PI, Mathf.Cos, Mathf.Sin, Quaternion) (0) 2022.07.08 WebGL publishing (0) 2022.05.13 Project Design Document (0) 2022.05.13