Zmiana czcionki (font) TMPro w Unity

using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class NapisComponent : MonoBehaviour
{
    [SerializeField] TextMeshProUGUI tekst1;

    public void ChangeFont()
    {
        // Pobiera czcionkę z obiektu tekstowego TMPro dziecka klikniętego przycisku
        tekst1.font = EventSystem.current.currentSelectedGameObject.GetComponentInChildren<TMP_Text>().font;
    }
}
Ask ChatGPT
Set ChatGPT API key
Find your Secret API key in your ChatGPT User settings and paste it here to connect ChatGPT with your Tutor LMS website.
Scroll to Top