Why unity crashes with my code ?

while (!gameDetails.serverLoaded)
{
BuildItAddon.BuildItAddon.ShowMessage(“Can’t join! the server is still loading! trying again!”);
Thread.Sleep(3000);
}

while I have this lines in my code the game won’t work. why ?

Because this loop runs infinitely if server never get loaded which causes the unity to crash. Things like Infinite loops, infinite memory usage,etc crashes unity.