How can I make it so a text is displayed after pressing a button numerous times?

Hi, I’m quite new to Unity and programming, and as an introduction I’m trying to make a game that once you start, you have to press a button numerous times so a text is displayed. How do I do it? (Thanks for any help)

Here is the script for the moment:

using UnityEngine;
using UnityEngine.UI;

public class TrollButton1 : MonoBehaviour
    public TMPro.TMP_Text displayText;

    public void DisplayText()
        displayText.text = "HELLO";


There is a quick unity learn course which should help: Creating UI Buttons - Unity Learn

Step 12 onward will show you how to hook up the button to your script.

Hope this helps :slight_smile: