Well I have this problem I have made this script so that the object moves, theres no error in the console yet Unity3d Freezes when I enter play mode, what could I do wrong?
var health : float = 100;
var atack : boolean = false;
var speed : float = 10;
var damage : float = 5;
// + if plyr1 - if plyer2
var PlyStatus : float = 1;
function Start () {
transform.LookAt(target);
atack = false;
}
function Update(){
while (atack == false)
{
rigidbody.AddForce(PlyStatus * speed * Time.deltaTime,0,0);
}
if(health <= 0)
{
Destroy(gameObject);
}
}
function OnTriggerEnter (col : Collider)
{
if(col.gameObject.tag == "Player2")
{
atack = true;
col.GetComponent(AI).health -= damage;
}
}