Score

 avatar
unknown
plain_text
18 days ago
579 B
4
Indexable
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class PointHandler : MonoBehaviour
{
    public int score = 100;
    public TextMeshProUGUI scoreText;
    public Button showScoreButton;

    void Start()
    {
        // Asegurarse de que el botón tenga el evento asignado
        if (showScoreButton != null)
        {
            showScoreButton.onClick.AddListener(DisplayScore);
        }
    }

    void DisplayScore()
    {
        if (scoreText != null)
        {
            scoreText.text = "Score: " + score;
        }
    }
}
Editor is loading...
Leave a Comment