Check out example codes for "unity text change percentage". It will help you in understanding the concepts better.
Code Example 1
using UnityEngine.UI;
using System.Collections;
public class PlayerHealth : MonoBehaviour
{
public Image PlayerHealthBar;
public Text Fraction;
public Text Percent;
public int maxHealth = 0;
public int curHealth = 0;
// Use this for initialization
void Start ()
{
Fraction.text = curHealth + "/" + maxHealth;
Percent.text = (curHealth/maxHealth) * 100 + "%";
}
// Update is called once per frame
void Update ()
{
}
}
Learn ReactJs, React Native from akashmittal.com