How to force Unity to Repaint an EditorWindow?

Hi, I have a problem with the OnGUI method:

In an EditorWindow class, I have

void OnGUI()
{
    _loadingDots += "."; 

    if(_loadingDots.Length >= 4)
        _loadingDots = ".";
		
    GUILayout.Label("Importing" + _loadingDots, EditorStyles.boldLabel);
    Repaint();
}

And in the Update:

void Update()

{

    _timer += Time.deltaTime;

	if(!_isProcessBusy)
	{
		if(_timer >= 0.5f)
			_isProcessFree = true;
	}

	if(_isProcessFree)
	{
		_isProcessFree = false;
		_isProcessBusy = true;
		Import();
	}
}

The problem is that when the Import() method is called the GUI freezes, but when the Import method finish then it repaints, How could I force to repaint? I know I’m using the Repaint method, but it seems doesn’t work or the OnGUI or Update are not called until the Import method finish.

Whatever your import method is doing is blocking the thread until finished. You’ll need to fire it off on another thread so the rest game doesn’t have to wait for it to finish to proceed.