Trigger a project refresh via script

Hi

I am looking for a way to trigger a project refresh via script.
A “project refresh” is what is done when you hit Ctrl+R or you click menu “Assets/Refresh”.

At the very least I actually need to trigger the re-compilation of the project’s scripts.

Thanks in advance.

AssetDatabase.Refresh should do the trick. It’s editor code, so make sure it’s in an Editor folder or wrapped in #if UNITY_EDITOR preprocessor conditional. (Note that if no project files have changed this shouldn’t do anything.)