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;
    }
}