Files
WildRoot/Assets/Script/RestartTextHandler.cs
T

23 lines
704 B
C#
Raw Normal View History

using UnityEngine;
using TMPro;
public class RestartTextHandler : MonoBehaviour
{
// [SerializeField]를 쓰면 private이어도 인스펙터 창에 뜹니다!
[SerializeField] private TextMeshProUGUI restartText;
void OnEnable()
{
// 이제 null 체크를 할 필요도 거의 없습니다. (인스펙터에서 넣을 거니까요)
if (restartText == null)
{
Debug.LogError("인스펙터에 텍스트 오브젝트를 할당해주세요!");
return;
}
if (GameSettings.IsMobile)
restartText.text = "Touch the screen to restart";
else
restartText.text = "Press the R key to restart";
}
}