Pete Verdon
0
Q:

unity text change percentage

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 ()      
    {      
    
    }       
}
0

New to Communities?

Join the community