Open scene by typing a word

I know that it’s possible to open/change a scene using scripts,like Click on buttons or pressing a keyboard key, or even using the mouse buttons.

But, is it possible to open/change a scene in game by tipping a word? For example “TEST”. When player types “TEST” in the keyboard, he is automatically moved to a new scene, like a cheat code. Is this possible? And if it is, what i need to do to make a script that work in this way?

All you need is an InputField. All you need to do is add a method to when the text is changed, under the TextField component. You’ll also want to detect when they press enter, so they can finish typing it before confirming they want to load that level. Then, all you need to do is load the level with the string that is provided.


In your scene, create an InputField. Add a C# script called LoadLevelCheatCode. In the code, type this:

using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;

public class LoadLevelCheatCode : MonoBehaviour {

	public string cheatcode = "tilt";

	public void SubmitCode(string code) {
		if (code.Equals(cheatcode) && SceneManager.GetSceneByName(cheatcode) != null) SceneManager.LoadScene(cheatcode);

In the script you put on the InputField, fill in the “Cheatcode” field with the level name. It must match case too. Then, on the InputField component, under the “End Edit” field, add one. Drag the C# script you made into the target field. That’s it! If you still need help, just leave another comment.
You can also personally contact me on Skype: Firedan1176 if you have other questions, or want a more instructive way to do this.