Wanted editor extension called only when changed

Hi, I am writing up an editor extension at the moment.
I was wondering whether what I wrote will be called everyframe or only when the property got changed?
If this got called Everyframe, can you help me change it to called only when property got changed?

THX in advance.

using UnityEngine;
using UnityEditor;
using System.Collections;

[CanEditMultipleObjects]
[CustomEditor(typeof(Unit))]
public class UnitEditor : Editor {
	
	Unit thisUnit;
	UNITCLASS currentClass;
	
	void OnEnable ()
	{
		thisUnit = (Unit)target;
    }
	
	 public override void OnInspectorGUI()
	{
		
		GUILayout.BeginHorizontal();
		currentClass = (UNITCLASS)EditorGUILayout.EnumPopup("Class", currentClass );
	    GUILayout.EndHorizontal();
		
		thisUnit.SetClass(currentClass);
    }
}

I Think this may help

UNITCLASS _currentClass;
UNITCLASS currentClass;
{
    set{
      if(_currentClass != value)
      { 
        _currentClass = value;
        thisUnit.SetClass(_currentClass);
      }
    }
    get{
       return _currentClass;
    }
}

...

public override void OnInspectorGUI()
{
   GUILayout.BeginHorizontal();
   _currentClass = (UNITCLASS)EditorGUILayout.ObjectField("UNITCLASS", _currentClass, typeof(UNITCLASS));
  GUILayout.BeginHorizontal();
}