Skip to content

Instantly share code, notes, and snippets.

@tayl0r
Created January 5, 2012 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tayl0r/1565900 to your computer and use it in GitHub Desktop.
Save tayl0r/1565900 to your computer and use it in GitHub Desktop.
public GUIText[] m_numbers = new GUIText[100];
void Start() {
if (m_timer) {
for (int i = 0; i < 11; ++i) {
GUIText number = Instantiate(m_timer) as GUIText;
number.text = i.ToString();
number.enabled = false;
Debug.Log(i);
// this is the line with the error
// IndexOutOfRangeException: Array index is out of range.
// (wrapper stelemref) object:stelemref (object,intptr,object)
m_numbers[i] = number;
}
m_timer.enabled = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment