Hello,
Does anyone know how to fix the error, I just can’t figure it out and nobody else has encountered this error in combination with something like my script.
Here’s the error:
IndexOutOfRangeExeption: Array index is out of range.
ScanConsole.Update () (at Assets/Scripts/ScanConsole.js:19)
And here’s the script:
public var computer : GameObject;
public var textMesh : TextMesh;
public var cam : GameObject;
public var scanGui : GameObject;
public var index : int = 0;
public var inScanner : GameObject[] = new GameObject[1];
public var isExit : boolean = false;
public var isArrayDisplay : boolean = false;
function Start () {
textMesh = GetComponent(TextMesh);
}
//textMesh.text = "";
function Update () {
textMesh.text = "Selected: " +
inScanner[index].transform.name;
}
function OnMouseDown () {
if(isExit){
cam.SendMessage("ExitGUI",
SendMessageOptions.DontRequireReceiver);
}
}
Thanks!