Unlock game with provided password / serial key

Hi. I want to unlock a mobile game with provided password / serial key. Below is the script that i used. I want to make the game unlocked using one password for one device. But i do not know how…

    public void GetInput (string guess) {
	if ((guess == "pass122") ||(guess == "pass133"))
	{
		Application.LoadLevel("Eat");
	} 

	else if (guess == "") 
	{
		OutputText.text = "Please enter your key";
	} 
	
	else 
	{
		OutputText.text = "Wrong key";
	}

You’re not calling your function anywhere so you it wouldn’t really work. Also, all GUIs should be called inside the OnGUI function. I modified your code a little. I’ve tested this one and it works fine with me. Let me know how it will go. xx

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

	public string levelCode;
	public bool isBlank;
	public bool isWrongKey;

	void OnGUI()
	{

		levelCode = GUI.TextField(new Rect(100, 100, 250, 30), levelCode);

		GUI.Label(new Rect(200, 60, 300, 40), "Enter Level");

		if (GUI.Button(new Rect(100,  140, 250, 30), "OK!"))
		 {
		    GetInput(levelCode);
		 }

		if(isBlank)
		{
			GUI.Label(new Rect(200, 200, 300, 40), "Invalid Key!");
		}

		if(isWrongKey)
		{
			GUI.Label(new Rect(200, 200, 300, 40), "Wrong Key!");
		}
	}

    public void GetInput (string guess)
     {
     if ((guess == "pass122") ||(guess == "pass133"))
     {
         Application.LoadLevel("Eat");
     	 isBlank = false;
         isWrongKey = false;
        //Debug.Log("Load level Eat");
     } 
     else if (guess == "") 
     {
        isBlank = true;
        isWrongKey = false;
        Debug.Log("Invalid Key!");
     } 
     
     else 
     {
        isWrongKey = true;
        isBlank = false;
        Debug.Log("Wrong Key!");
     }
}

}