소소한 개발 공부
[Unity] TextMeshPro Dilate script로 제어하기 how to edit TextMeshPro Dilate 본문
개발/Unity
[Unity] TextMeshPro Dilate script로 제어하기 how to edit TextMeshPro Dilate
이내내 2022. 10. 5. 23:02https://answers.unity.com/questions/1676414/how-to-edit-text-mesh-pro-face-dilate-through-scri.html
How to edit Text Mesh Pro face dilate through script - Unity Answers
answers.unity.com
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class testdilate : MonoBehaviour
{
public TextMeshProUGUI bi;
public void OnClick()
{
StartCoroutine(StartSFX());
}
IEnumerator StartSFX()
{
float value = 0.5f;
float time = 0f;
Color color = bi.color;
while (value > -1f)
{
time += Time.deltaTime;
value = Mathf.Lerp(0.5f, -1f, time);
bi.fontMaterial.SetFloat(ShaderUtilities.ID_FaceDilate, value);
color.a = Mathf.Lerp(1f, 0f, time);
bi.color = color;
yield return null;
}
}
}
천천히 사라지는 연출을 하고자 했다. TextMeshPro - Face Dilate 값을 에디터 상에서 조절하니 꽤나 그럴 듯해 보여서 스크립트로 활용했다.
'개발 > Unity' 카테고리의 다른 글
ML-agent 2.2.1 설치 (0) | 2022.11.22 |
---|---|
[Unity] 파일 입출력 how to open binary file in unity mobile app (0) | 2022.10.04 |
[C#] 초(sec)를 시간 형식으로 바꾸기 (0) | 2022.08.18 |
FPS 캐릭터 이동 CharacterController (0) | 2022.03.31 |
List 에 배열 넣기, List에 원소들 한 번에 넣기 (0) | 2022.03.23 |