public static variable not showing on UI Text

Hi guys,

This is a very weird thing which is happening, basically I am trying to print the health on a UI however it is not being displayed. I have try to test with a normal integer and it did work.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class PlayerHealth : MonoBehaviour {

    public static int health = 1000;
    Text healthTxt;
	// Use this for initialization
	void Start () {
        healthTxt = GameObject.Find("healthTxt").GetComponent<Text>();  

    // Update is called once per frame
    void Update () {
        healthTxt.text = "Health: " + health;
		if(health <= 0)


Hi thanks for your interest. I just fixed it! I knew it was a stupid mistake.

Basically all I had to do was to tick “Best Paragraph” from the Text component of the Text object!