unity crashes with a while loop

in this part of the script, a float variable is incremented while the player release the fire1 button, but always, when i try this, unity crashes.

if (Input.GetButtonDown("Fire1"))
{
	while (!Input.GetButtonUp("Fire1"))				
	{
		Power = Power + 1 * Time.deltaTime;
		Debug.Log(Power);
	}
}

“power” is a public float.
it happens even if i invert the while and BottonUp (while (Input.GetButtonDown(“Fire1”))
thanks for the time

Input.GetButtonDown and Input.GetButtonUp will never be true in the same frame, so you’re always entering an infinite loop. I believe what you meant to do is:

if (Input.GetButton("Fire1"))
{
  Power = Power + 1 * Time.deltaTime;
  Debug.Log(Power);
}