Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

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

InputField.isFocused

Switch to Manual
public var isFocused: bool;

Description

Does the InputField currently have focus and is able to process events.

#pragma strict
// Required when Using UI elements.
public class Example {
	public var mainInputField;
	function Update() {
		//If the input field is focused, change its color to green.
		if (mainInputField.GetComponent.<InputField>().isFocused == true) {
			mainInputField.GetComponent.<Image>().color = Color.green;
		}
	}
}