Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

InputField.onEndEdit

Switch to Manual
public var onEndEdit: UI.InputField.SubmitEvent;

Description

The Unity Event to call when editing has ended.

#pragma strict
// Required when Using UI elements.
public class Example {
	public var mainInputField;
	// Checks if there is anything entered into the input field.
	function LockInput(input) {
		if (input.text.Length > 0) {
			Debug.Log("Text has been entered");
		}
		elseif (input.text.Length == 0) {
			Debug.Log("Main Input Empty");
		}
	}
	public function Start() {
		//Passes the main input field into the method when "LockInput" is invoked
		mainInputField.onEndEdit.AddListener(function() {
			LockInput(mainInputField);
		});
	}
}