Text console games are simpler than graphical ones and help you to learn fundamental C# programming concepts like data structures.
Create a text-only game using the Debug.Log console
The simplest possible game we can make in Unity is one that uses Debug console output and single keys as input.
- Make a new scene.
- Copy the code for Presser.cs from the pastebin link.
- In Project > Create > C# Script
- Name it Presser and hit return
- Open it in your code editor
- Paste the Presser code
- Save it
- In Unity, Hierarchy > Create > Create Empty
- Name it Presser and hit return
- Drag the Presser script onto the empty game object
- Save the scene, name it Presser
- Arrange your Editor to be able to see
- Make sure your Game view has focus
- Make sure you can see several lines of the Debug Console
- In Console panel, disable Collapse because we do not want to combine similar debug messages.
- Hit play to test the game
- Press RETURN to start the game timer
- Press SPACE 10 times as fast as you can
- Try to get the fastest time
- Hit STOP to end the game
- Hit PLAY again
- Notice that it saves our high scores from before and remembers them using PlayerPrefs
Presser 2 – The Sequel
- Duplicate the Presser script in the Project view
- Rename it Presser2
- Open it and rename the class at the top to Presser 2
- Save the script
- Create a new scene
- Create an empty game object
- Name it Presser2
- Drag the Presser2 script onto the object
Making a text console with input
Unity has an official tutorial series on making a full text adventure game with keyboard input.
https://learn.unity.com/tutorial/recorded-video-session-text-adventure-game-part-1
https://learn.unity.com/tutorial/recorded-video-session-text-adventure-game-part-2