I’m getting the error “An object reference is required for the non-static field, method, or property ''Character.Vitality”
This would be the BattleHUD code
public class BattleHUD : MonoBehaviour
{
public Text nameText;
public Text levelText;
public Slider hpSlider;
public void SetHUD(Character character)
{
nameText.text = Character.CharacterName;
levelText.text = "Lvl " + Character.CharacterStat.Level;
hpSlider.maxValue = Character.Vitality;
hpSlider.value = Character.CurrentHP;
}
public void SetHP(int hp)
{
hpSlider.value = hp;
}
}
}
And this would be the character code from witch i want to take the stats reference.
public class Character : MonoBehaviour
{
public CharacterStat Strength;
public CharacterStat Agility;
public CharacterStat Intelligence;
public CharacterStat Vitality;
public CharacterStat Level;
public int Currenthp;
public string CharacterName;