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 () {
		if(Time.time - lastUpdate >= 1f){
			lastUpdate = Time.time;


@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.