Hi, I have a script here that calculates the percentage between two numbers, but it’s in reverse. Reverse as in 0 is seen as 100% of 100 instead of the other way around. (100 being 100% of 100).
Does this have to be written in a specific way?
using UnityEngine;
using System.Collections;
public class percentagetest : MonoBehaviour
{
public float maxValue;
public float currentValue;
private float finalValue;
void Update ()
{
finalValue = (maxValue - currentValue) / maxValue * 100;
//Calculate percentage
}
void OnGUI ()
{
GUI.Label(new Rect(5,5,250,250),finalValue.ToString());
//Display result
}
}