using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using StarterAssets; using TMPro; public class Player : MonoBehaviour { public int MaxHp = 100; public int Hp = 10; public GameObject HpBar; public GameObject HpText; // Start is called before the first frame update void Start() { SetHp(); } public void SetHp() { HpBar.GetComponent().value = Hp; //Debug.Log(HpBar.GetComponentInChildren().text); HpText.GetComponent().SetText(Hp + "/" + MaxHp); } // Update is called once per frame void Update() { } }