SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
923 B

using System.Collections;
using UnityEngine;
using UnityEngine.Serialization;
namespace ARLocation.Utils
{
public class FadeOutTextMesh : MonoBehaviour
{
[FormerlySerializedAs("duration")] public float Duration = 2.0f;
private TextMesh textMesh;
// Use this for initialization
void Start()
{
textMesh = GetComponent<TextMesh>();
StartCoroutine("FadeOut");
}
IEnumerator FadeOut()
{
var t = Duration;
var initialColor = textMesh.color;
while (textMesh.color.a > 0.001f)
{
var color = textMesh.color;
var target = new Color(color.r, color.g, color.b, 0);
textMesh.color = Color.Lerp(initialColor, target, 1 - t / Duration);
t -= Time.deltaTime;
yield return null;
}
}
}
}