How to set up a password to be used in the password input field?

Hi,

I would like to set up a password login for my game.
I would simply like the user to put their password in, then the level load when it is correct.

I previously used the following script -

#pragma strict

var password : String = "";
function OnGUI () {

password = GUI.PasswordField (Rect (Screen.width/2, Screen.height / 1.95, 256, 32), password, "*" [0], 25);

if (password == "password123") 
{

Application.LoadLevel("Level_1");

}

}

This works fine, but I would like to be able to use it with the 4.6+ UI.

I know to add an InputField, then choose the type to ‘Password’.
However I am slightly lost for what to do next, I assume a script has to be set up to attach to the ‘On Value Change (String)’, but not sure what it is.

I have searched for a tutorial that deals with this specifically, but cannot find one that gives a step by step guide for setting it up. I’m new to coding, so would like to know exactly what to do.
If someone could help me, or at least point me in the direction of such a tutorial, it would be much appreciated.

Many thanks

Oh, the new system is great, you’ll see. Just write a script to handle the change. Give it a function that takes a single parameter (a string).

Then, add that script to a gameobject. In the InputField settings, under OnValueChanged, click the plus button. Then drag the object with your new script to the field. Then, in the drop-down on the right, select your script and function.

Now, when the text changes, it will call that function, and you can respond to it however you like.