Files
GeoSusGame/Assets/Scripts/ukazmeno.cs
2026-05-17 12:34:22 +02:00

22 lines
593 B
C#

using UnityEngine;
using TMPro;
public class ukazmeno : MonoBehaviour
{
[SerializeField] private TMP_Text target;
[SerializeField] private string prefix = "name: ";
void Start()
{
if (target == null)
target = GetComponent<TMP_Text>();
string saved = PlayerPrefs.GetString("PlayerName", "");
if (string.IsNullOrWhiteSpace(saved) && GameManager.Instance != null)
saved = GameManager.Instance.displayName;
if (target != null)
target.text = string.IsNullOrWhiteSpace(saved) ? prefix : prefix + saved;
}
}