I'm making and game which has digging as it's feature so I need timer which will count exact float (in seconds) and then destroy gameObject. This is what I tried now but it's freezing unity:

```
function Update()
{

if (Input.GetMouseButtonDown(0))
{
                        digTime = 1.5; // in secounds
                  }
                  while (!Input.GetMouseButtonUp(0)) // why is this infinite loop?
                  {               
                  digtime -= Time.deltaTime;
                  if (digtime <= 0)
                  {
                  Destroy(hit.collider.gameObject);
                  }
        }

```