Unity Text Implementation

Hello, I have a problem with displaying the text so I have created a function to call in when a player wins but i want it to display the winning notification as a text. I have tried the UI Text but it gives me NullRefrence error because my method are static and if I made the text static I cant put in the script
Is there a way I can display the winning text with all my functions being static because when i print it the winning message on console works as it displays it.

    public static void winner(){
public static Text winText;

            if (GameManager.Instance.GameOver) {
              if (turn == 1) {
            //    winText.text = "you win";
                print("p1 win");

            }
            if (turn == 2) {
            //winText.text = "you loose";
                print ("a1 win");
            }
        }
    }

NullReferenceException: Object reference not set to an instance of an object
ButtonScript.winner () (at Assets/ButtonScript.cs:61)

What I would do is make a public Text winnerText variable in your GameManager class, and if this script is in another class, after you find the winner, send the info to the GameManager.Instance
a method like:

// this is in GameManager
// just link the Text UI object in the inspector, and you're set.
public Text winnerText;
public void ShowWinner(string message) {
   winnerText.text = message;
   }

// So you could call that like this...
// this is in the ButtonScript
GameManager.Instance.ShowWinner("p1 win");

thanks a bunch that worked :slight_smile:

Cool :slight_smile: