Why does this script make unity crash?

`using UnityEngine;
using System.Collections;
//THIS SCRIPT MAKES UNITY CRASH-------------FIGURE OUT WHY
public class weaponProjectileInst : MonoBehaviour
{
public bool hasntHitAnything = true; //condition for while loop
public float bulletSpeedValue;
public float bulletDropValue;

// Use this for initialization
void Start ()
{

}

// Update is called once per frame
void Update ()
{
    while (hasntHitAnything == true)//code for bullet drop and stuff here
    {
        transform.Translate(Vector3.forward * Time.deltaTime * bulletSpeedValue);//Move Forward
        transform.Translate(Vector3.down * Time.deltaTime * bulletDropValue);//bullet drop
        
    }
}

void OnTriggerEnter(Collider other)
{
    hasntHitAnything = false;
    Destroy(this);
}

}
`

so basically i was starting out with some code for a projectile script, but everysingle time it makes unity crash

It’s a problem because you have an infinite loop. First, you set your hasntHitAnything bool to true. Then, Unity enters the Update method on the first frame. There, as long as the bool is true, you continue to loop. That loop will never exit as you’re never giving anything else a chance to run (including your OnTriggerEnter method) - it just loops there forever.

You need to remove that while loop.