How to make text appear in console via a certain key?

How will I make certain text appear in the console by pressing a certain key?

If I have one single text like: I don’t need to get outside.

How do I make an script by that in .cs file?

Ok, the best way to do that to is to make text in the editor and disable it. And with your code make it enable and disable the text.

import UnityEngine.UI;

In order to edit UI you need to import it.

Then next you need to enable/disable the UI text:

if (GetComponent.<Text> ().enabled = true) {
    GetComponent.<Text> ().enabled = false;
} else if (GetComponent.<Text> ().enabled = false) {
    GetComponent.<Text> ().enabled = true;

this code should toggle the visibility of the text as long as you replace it with Debug.Log(“TALK”); and the text component you toggle is in the same GameObject. If it is not, make a variable text and replace it with GetComponent.() in the if statement. Leave .enabled = true/false not deleted:

public Text myText;

In the editor drag your text into the myText variable. Hope it helps!