Unity crashes because of script

hello, i know this is a noobie question but i cant figure it out, i have a loop script and when i try to run it unity crashes. it works fine with everything else its just this script. any help is appreciated

#pragma strict
var i:int=0;
var Prefab:GameObject;
var lastUpdate:float=0;
function Start () {

}

function Update () {
while(i<10){
	print(i);
	
	
		if(Time.time - lastUpdate >= 1f){
			lastUpdate = Time.time;
			i++;
			Instantiate(Prefab,transform.position,transform.rotation);
		}
}

}

@husainh00, here “i” is never changed. Here “while” is continuous running because “i” is always less than 10. so unity stuck and crash.

Here Unity Crashes because you are running an infinite loop as stated by YashPal.

Value of “i” never changes here.

as lastUpdate = Time.time ,So Time.time-lastUpdate < 1f so " i " will not be incremented.