On Unity focus callback?

Is there any callback I can use when Unity gets focus? I.e. when I switch from another application (such as Monodevelop) to the Unity Editor? All I can find is EditorWindow.OnFocus() but this is is for a separate Unity Editor window, not Unity itself.


EDIT: I want to do this so when I change some data files, Unity automatically parses them whenever I get back to the editor. I have a couple of jsons that contain stats and those will regularly change during development. Right now I have a timer that checks for changes every x-seconds which does the job, albeit not really efficient.

There is no OnFocus callback inside the editor. However what you want to do can easily be done with an AssetPostProcessor. Of course the import is only executed for assets that Unity supports. Files with the extension “.txt" / ".json” / “.xml" or ".bytes” are recognised as TextAsset.

You can use OnPostprocessAllAssets and filter out your desired assets and preform your post process actions.