Unity_Utils/UI/Components/TextUIComponent.cs
2021-07-31 22:24:34 -04:00

22 lines
579 B
C#

using TMPro;
using UnityEngine;
namespace UI
{
public class TextUIComponent : UIComponentBase
{
[SerializeField] private TMP_Text _text;
private string _initialText;
private void Awake() => _initialText = _text.text;
public void SetText(string newText) => _text.text = string.IsNullOrEmpty(newText) ? string.Empty : newText;
public void ResetText() => _text.text = _initialText;
public void AddText(string textToAdd) => _text.text += textToAdd;
public void HideText() => _text.text = string.Empty;
}
}