- Home /
ArrayIsOutOfRange
Hello , I a have been facing this problem recently : (IndexOutofrangeException:array index is out of range ( wrapper stelemref) object:stelemref(object,intptr,object)
My script:
using UnityEngine; using System.Collections; using System;
public class CharacterGenerator : MonoBehaviour { private PlayerCharacter _toon;
// Use this for initialization
void Start () {
_toon = new PlayerCharacter();
_toon.Awake();
}
// Update is called once per frame
void Update () {
}
void OnGUI() {
GUI.Label(new Rect(10, 10, 50, 25), "Name:");
_toon.Name = GUI.TextArea(new Rect(65,10,100,25), _toon.Name);
for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
GUI.Label(new Rect(10,40 + (cnt * 25 ), 100,25 ) , ((AttributeName)cnt).ToString());
GUI.Label(new Rect(115,40 + (cnt * 25 ), 30,25 ) , _toon.GetPrimaryAttribute(cnt).AdjustedBaseValue.ToString());
}
Any Help Would Be Appreciated , Ty.
Piece of advice, we don't need any irrelevant parts of your code. The empty Update function for instance, I'm pretty sure that's not related to your problem. The longer your script, the less answers you'll get I'm afraid. As for your problem, what in the name of all the coconuts are you trying to achieve with those attributes and co ?
You are following the BurgzergArcade tutorial aren't you?
Your answer
![](https://koobas.hobune.stream/wayback/20220613063743im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Array Out Of Range: Jibe 0 Answers
Index Array is out of Range 1 Answer
Array out of index? 1 Answer
IndexOutOfRangeException only on iOS! Android / PC is ok!! 1 Answer
Array index is out of range 2 Answers