/// Sourced from - http://forum.unity3d.com/threads/inputfield-focus-and-unfocus.306634/
/// Usage, assign component to Input field, set OnEndEdit function to the one in this script and the Click for the submit button to the buttonPressed function.
namespaceUnityEngine.UI.Extensions
{
[RequireComponent(typeof(InputField))]
[AddComponentMenu("UI/Extensions/InputFocus")]
publicclassInputFocus:MonoBehaviour
{
#region Private Variables
// The input field we use for chat
protectedInputField_inputField;
// When set to true, we will ignore the next time the "Enter" key is released
publicbool_ignoreNextActivation=false;
#endregion
voidStart()
{
_inputField=GetComponent<InputField>();
}
voidUpdate()
{
// Check if the "Enter" key was just released with the chat input not focused