A while loop continues to loop as long as the condition is true. If just you supply “true” as the condition, it will naturally always evaluate as true and therefore will continue looping forever, unless the loop is broken some other way.
It’s not continuous: “if(Input.GetKey(“1”)) return;” That makes the function end if the “1” key is pressed.
I’m not sure what you’re attempting there, but it accomplishes literally nothing at all.
No, it won’t. In fact that code wouldn’t even compile; “var true” is a syntax error. I guess you want
function Update(){
abc(true);
}
function abc(var runLoop : boolean){
while(runLoop){
}
}
However, that’s still pointless…calling “abc(false)” wouldn’t do anything, so why bother? And if you called “abc(true)”, you’d be starting a new infinite loop every frame, so in short order you’d have thousands of infinite loops running all at once, and then it would crash.
Yeah, the easiest way to lock up any program is with while(true){}. Thats called an infinite loop. Always make sure there is a way within the loop where the value being evaluated can be switched to false or if you have code that jumps out of it like a return.