Hello, how to make 80% from float 25 ?
public float number;
void Start () {
number = 25f;
}
void Update () {
If (Input.GetKeyDown(KeyCode.A)
{
number = number / 100 * 80;
Debug.Log(number);
}
}
}
But this don’t work, thanks for help .
StaNov
2
Try to multiply the number by 0.8 instead of dividing and multiplying again:
number *= 0.8;
Beware, the number gets lowered every time the A-button is pressed.