- Home /
Object Reference
I have an object reference not set to an instance of an object... here is the set of code. If you need m more of the script I will post it, but it's long.
private void SetupSkillModifiers() {
//Melee Offence
ModifyingAttribute MeleeOffenceModifier1 = new ModifyingAttribute();
ModifyingAttribute MeleeOffenceModifier2 = new ModifyingAttribute();
MeleeOffenceModifier1.attribute = GetPrimaryAttribute((int)AttributeName.Might);
MeleeOffenceModifier1.ratio = .33f;
MeleeOffenceModifier2.attribute = GetPrimaryAttribute((int)AttributeName.Nimbleness);
MeleeOffenceModifier2.ratio = .33f;
>GetSkill((int)SkillName.Melee_Offence).AddModifier(MeleeOffenceModifier1);
GetSkill((int)SkillName.Melee_Offence).AddModifier(MeleeOffenceModifier2);
//melee defence
ModifyingAttribute MeleeDefenceModifier1 = new ModifyingAttribute();
ModifyingAttribute MeleeDefenceModifier2 = new ModifyingAttribute();
MeleeDefenceModifier1.attribute = GetPrimaryAttribute((int)AttributeName.Speed);
MeleeDefenceModifier1.ratio = .33f;
MeleeDefenceModifier2.attribute = GetPrimaryAttribute((int)AttributeName.Composition);
MeleeDefenceModifier2.ratio = .33f;
GetSkill((int)SkillName.Melee_Defence).AddModifier(MeleeDefenceModifier1);
GetSkill((int)SkillName.Melee_Defence).AddModifier(MeleeDefenceModifier2);
Not only what line, please look on the line that is indicated and post that and anything related ins$$anonymous$$d of a huge chunk of code...
Answer by DoctorWhy · Nov 14, 2012 at 10:34 PM
SkillName is probably not assigned. Find where it is assigned, and make sure it gets assigned before that function is called (or before any code in that function use it).
ok let me look at the thing I was following... I will get back here as soon as I find it.
Your answer
Follow this Question
Related Questions
CAN SOMEONE FINALLY HELP ME! 3 Answers
NullReferenceException: Object reference not set to an instance of an object 1 Answer
Unity c# Object reference not set to an instance of an Object ( Shooting Script ) 0 Answers
Order scripts execute "start" or order of "update" every frame, c# mainly 2 Answers