Quantcast
Channel: Latest Questions by CuddleMonster
Viewing all articles
Browse latest Browse all 20

Array Index out of range?

$
0
0
`enter code here`I'm quite confused by this little issue. I've dealt with arrays and classes before, but clearly I've made some sort of mistake. I keep getting Array Index is out of range on the line: Equip(AllSkills[0],0); AllSkills, the Array of the class "Skill" has members in it... as does SkillSlot(Though I believe the out of range is refering only to AllSkills). I added these members in the inspector and they are filled out. What is my mistake? class Skill { //Active or Passive var Active : boolean; //SkillObject var TheObject: GameObject; var CooldownCurrent : float; var CurrentStamina : int; var StaminaCost : int; } var AllSkills : Skill[]; var SkillSlot : Skill[]; function Equip ( NewSkill : Skill, Slot : int ) { SkillSlot[Slot] = NewSkill; if (!SkillSlot[Slot].Active) { Instantiate (SkillSlot[Slot].TheObject,transform.position,transform.rotation); } } function Activate ( Slot : int ) { if (SkillSlot[Slot].CooldownCurrent == 0 && SkillSlot[Slot].StaminaCost

Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles





Latest Images