Ingame the script will not run as the index is out of range on this script. It is only occurring on one line.
public class AIController : MonoBehaviour {
float tlu;
float tld;
int RibI;
public float[] tibl;
int RprsdI;
public float[] tprsdl;
public int whichOne = 0;
public bool record;
void Update () {
float timer = 0;
bool pressing = false;
if (record) {
tlu += Time.deltaTime;
if (Input.GetKeyDown ("right")) {
tibl [RibI] = tlu;
RibI++;
}
if (Input.GetKey ("right")) {
tld += Time.deltaTime;
}
if (Input.GetKeyUp ("right")) {
tprsdl [RprsdI] = tld;
RprsdI++;
tld = 0;
tlu = 0;
}
}
if (!record) {
timer += Time.deltaTime;
//this line
if (timer >= tibl[0]) {
transform.Translate (1, 0, 0);
timer = 0;
pressing = true;
}
if(timer >= tprsdl[whichOne] && pressing) {
whichOne++;
pressing = false;
timer = 0;
}
}
}
}
I honestly don’t know how, I think it is something that i did. It occurs on that line and only that line, and yes i did set the values of the array to a number higher than zero and it still did not work. I appreciate the help.