Why is my text not changing?

Why isn’t my text changing in addPoint()? The function is being called (“ADD POINT” shows in console), and the text does change in start() and update(), but won’t change in addPoint().


using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class gameManager : MonoBehaviour
    public GameObject canvas;
    public Text pointText;
    private int points = 0;

    public void Start()
        pointText.text = "0";
        Time.timeScale = 1;
    public void gameOver()
        Time.timeScale = 0;
        pointText.text = "TEST";
    public void addPoint()
        Debug.Log("ADD POINT");
        pointText.text = (++points).ToString();


Most probably you are using TextMeshPro text, so is not a Text variable, is a TMpro

TextMeshPro mText = gameObject.GetComponent<TextMeshPro>();

mText.text = "test";


Thank you, but I’m using a text object (Text (Legacy)), and it still works in GameOver() and Start()?