I attach a script to a simple cube which bounded by four other cube. But when I play, unity stops responding. Is anything wrong in my script, or any other suggestion please ?
using UnityEngine;
using System.Collections;
public class gunf : MonoBehaviour {
public int sec;
public float value;
public float ras;
public bool isDown;
public Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update () {
}
void FixedUpdate () {
while(Input.GetMouseButtonDown (0) && isDown == false){
isDown = true;
ras = Random.Range (10f, 40f);
rb.AddForce (transform.up * ras);
Debug.Log (ras);
isDown = false;
}
}
}
Sorry for bad english.