I'm getting an index our of range exception at the beginning of my program, but can't seem to figure out what's causing it. The array in question is of colors from where to pick from, and the index is 0, trying to select the very first color (blue).
The error happens on the awake stage, when Unity attempts to pick the first color by default.
Color array to prove it's not empty
Error and debug log proving it's actually picking the right color
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class HexMapEditor : MonoBehaviour {
public Color[] colors;
public HexGrid hexGrid;
private Color activeColor;
void Awake() {
SelectColor(0);
}
public void SelectColor (int index) {
activeColor = colors[index];
Debug.Log(activeColor);
}
A different question here said the problem might be fixed by resetting the component, which I did but my problem wasn't fixed.
I'm really stumped here, so any help is appreciated.