Check field value after losing focus

I want to validate the value of a TextField in the editor and display an error message, but only after the user finished typing the value. I guess checking the value after the field lost focus could work, but I don’t think the editor has hooks for this.

So, what’s the trick to implement a “onFocusOut” behavior for a field? Or maybe there’s a better idea to achieve this?

GUI.GetNameOfFocusedControl will help you here. You need to name your TextField with GUI.SetNextControlName first, then just do a check in your OnGUI

if (GUI.GetNameOfFocusedControl() != "MyNamedTextField" && myNamedTextFieldString != "")
//Do checks to see if input is correct.