Ejemplo n.º 1
0
 void Update()
 {
     // Check if the "Enter" key was just released with the chat input not focused
     if (UIExtensionsInputManager.GetKeyUp(KeyCode.Return) && !_inputField.isFocused)
     {
         // If we need to ignore the keypress, do nothing - otherwise activate the input field
         if (_ignoreNextActivation)
         {
             _ignoreNextActivation = false;
         }
         else
         {
             _inputField.Select();
             _inputField.ActivateInputField();
         }
     }
 }
Ejemplo n.º 2
0
        public void OnEndEdit(string textString)
        {
            // If the edit ended because we clicked away, don't do anything extra
            if (!UIExtensionsInputManager.GetKeyDown(KeyCode.Return))
            {
                return;
            }

            // Do whatever you want with the input field text here

            // Make note of whether the input string was empty, and then clear it out
            bool wasEmpty = _inputField.text == "";

            _inputField.text = "";

            // if the input string was empty, then allow the field to deactivate
            if (wasEmpty)
            {
                _ignoreNextActivation = true;
            }
        }