hello everyone , can any one help i want to make a text text appear chen i press a keyboard button in unity3D
thank u
Welcome to the forums! This will get you started down the right path!
Here’s a short summary of how to do it:
-
Right click in the hierarchy (the window with all the objects in the scene)
-
Click UI → Text, which will create a gameobject with a text-component onto it. You also have a package called TextMeshPro for more advanced text-options and better looking text. I believe Unity imports it into projects by default now, but otherwise you could add it via the package manager. Here’s also a video that will give you a general idea about using text:
https://www.youtube.com/watch?v=D33d4w89vTs -
Disable the text-object, so you can make it only appear upon button press. Or just disable the text-component, if there’s other components that you’d like to use on the text-gameobject, even when the text isn’t visible.
-
Create a script that detects input and enables the text-object/-component. Simple input detection can be done by putting Unity - Scripting API: Input.GetKeyDown into an if-statement. But I believe using the new input system is pretty much the standard now. But that’s a whole other topic to look into (searching for ‘Unity input system’ on YouTube will get some good tutorials).