Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

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

InputField.onEndEdit

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);
        });
    }
}

Did you find this page useful? Please give it a rating: