How do I prevent value using EditorGUILayout.FloatField to not change as soon as I change the float field value ?

this is an example of what my code looks like .
how do i make the value only change when i have clicked outside of the field after changing the value or only after pressing the enter key ?

int amount;

void OnGUI()
{
amount = (int)EditorGUILayout.FloatField("Number of types",amount, GUILayout.MaxWidth(200)));
}

int amount;
int tempAmount;

 void OnGUI()
 {
 tempAmount = (int)EditorGUILayout.FloatField("Number of types",tempAmount, GUILayout.MaxWidth(200)));
   if(  Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return){
   {
   amount = tempAmount;
   }
 }

I am not sure about using Input.GetKeyUp in OnGUI, I seem to vagely remember something about that :confused:

Good luck!