I need another set of eyes to figure out a problem. I have an error of:
NullReferenceException: Object reference not set to an instance of an object
The commented lines are where it happens:
private void DisplayMercAttributes(){
for(int cnt = 0; cnt < Enum.GetValues(typeof(MercenaryVariable)).Length; cnt++){
GUI.Label (new Rect(10, 70 + (cnt * LineHeight), 70, LineHeight), ((MercenaryVariable)cnt).ToString ());
//GUI.Label (new Rect(85, 70 + (cnt * LineHeight), 70, LineHeight), _protag.GetMercAttribute(cnt).AcceptedValue.ToString ());
}
private void DisplayPracAttributes(){
for(int cnt = 0; cnt < Enum.GetValues (typeof(PractitionerVariable)).Length; cnt++){
GUI.Label (new Rect(10, 70 + (cnt * LineHeight), 70, LineHeight), ((PractitionerVariable)cnt).ToString());
//GUI.Label (new Rect(85, 70 + (cnt * LineHeight), 70, LineHeight), _protag.GetPractAttribute(cnt).AcceptedValue.ToString());
}
The problem lies at _protag.GetMercAttribute(cnt) and _protag.GetPracAttribute(cnt). It shouldn’t happen because the other attributes are set up the same way and work. The only difference between those attributes and these ones are that they only have 1 thing in their enum list, while the others have multiple things.
Read through my explanation of the null reference exception [HERE][1]. After having read it, show the relevant portion of your code and explain why you think the null reference should not happen. Maybe someone will be able to help you then. [1]: http://answers.unity3d.com/questions/528288/null-reference-exception-what-is-it-and-why-do-i-g.html
– Jamora