mirror of
https://github.com/ConjureETS/Unity_Utils.git
synced 2026-03-24 04:50:58 +00:00
22 lines
579 B
C#
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;
|
|
}
|
|
} |