Hey, I’ve just been following BurgZergArcade’s tutorials and I seem to have made a typo causing an “Object reference not set to an instance of an object” error to be printed many times a second and I cant for the life of me find where I’ve gone wrong (I’ve spent the last hour going over the videos again but to no avail.) Could someone please point out where I’ve gone wrong? I’ll be extremely grateful.
GUI display code for the integer:
private void DisplaySkills(){
for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) {
GUI.Label(new Rect(250, 50 + (cnt * 25), 100, 25), ((SkillName)cnt).ToString());
GUI.Label(new Rect(355, 50 + (cnt * 25), 30, 25), _toon.GetSkill(cnt).AdjustedBaseValue.ToString());
}
}
And the script for setting up the skills:
public class Skill : ModifiedStat {
private bool _known;
public Skill(){
_known = false;
ExpToLevel = 25;
LevelModifier = 1.1f;
}
public bool Known {
get{ return _known;}
set{ _known = value; }
}
}
public enum SkillName{
Melee_Offence,
Melee_Defense,
Ranged_Offence,
Ranged_Defense,
Magic_Offence,
Magic_Defense
}
Many thanks.
EDIT: The scripts for the vital stats and attributes work fine.