- Home /
NullRefenceException: Object reference not set an instance of an object
hi i have 1 question. when i click play on the unity works but on the console gives me the same error over and over again just tells me that:
NullRefenceException: Object reference not set an instance of an object CharacterGenerator.DisplaySkills() (at Assets/Scripts/Character Classes/CharacterGenerator.cs:49) CharacterGeneratorOnGUI() (at Assets/Scripts/Character Classes/CharacterGenerator.cs:23
the script is:
void OnGUI() {
DisplaySkills();
}
private void DisplaySkills() { for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) { GUI.Label(new Rect(150, 40 + (cnt 25), 100, 25), ((SkillName)cnt).ToString()); GUI.Label(new Rect(255, 40 + (cnt 25), 100 , 25), _toon.GetSkill(cnt).AdjustedBaseValue.ToString()); } }
what i can doo to fix this?
Please send the line 49 of your CharacterGenerator script.
well the second part of your code is kinda hard to read, but I'm guessing it has something to do with the variable SkillName such as it being an empty Array.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Finding the player that walked into a ray? 1 Answer
PolyLine Script form Unify Wiki help... 1 Answer
Instantiate for few seconds 1 Answer
Edit this code? 0 Answers