UI 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”);
}
}

That’s wrong. This will freeze your entire game. And also won’t allow you to block for specific amount of time.

Use coroutines to wait.

understood. thanks