New gui: How to disable keyboard input when user is typing?

How can I disable unrelated keyboard input when user is typing in an InputField?

Okay, answering myself. Kinda hackish, but it works:

	void Update () {
		//switching between mouse modes
		if ((Input.GetButtonUp("M"))){
			GameObject go = EventSystem.current.currentSelectedGameObject;
			InputField inputField = null; //creating dummy, null, InputField component
			if (go!= null) {
				inputField = go.GetComponent<InputField>(); //trying to get inputField component
			}
			//if inputField still equals null, it means user isn't in edit field
			if (inputField==null) {Globals.lockmouse = !Globals.lockmouse;}
		}
	}

I’ll try to refactor it later.

With getnameoffocusedcontrol you can easily fix this. Add this script to your moving object:

if(GUI.GetNameOfFocusedControl() != "NameOfInputField"){
  //your code to move the object
}