UI Thread Blocking

I try to run the testing and it block the UI updating. i found once the following scripts completed and unity only run UI updating for “this.Button.GetComponentInChildren().gameObject.SetActive(false);” and “Debug.Log”. any idea how to resolve this issue?

public void Click()
{
this.Button.GetComponentInChildren().gameObject.SetActive(false);
float time = 0;
while (time <= 1000000)
{

time++;
Debug.Log(“Im doing heavy work”);
}
}

Unity editor runs on the main thread, together with the game loop. Your while loop blocks the main thread for a long time, because of all those Debug.Log calls.

yes. finally find out need to use async/wait calling or coroutine. Many thanks for our advice.