but I get this error
IndexOutOfRangeException: Index was outside the bounds of the array.
Cycle.Update () (at Assets/Cycle.cs:12)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cycle : MonoBehaviour
{
void Update ()
{
if (Input.GetKeyDown("space"))
{
Display.displays[2].Activate();
}
}
}
Index out of bounds means just what it says. The index you use to access an array is outside the bounds of the array, ie you are trying to access an element that does not exist index-wise.
You only have one array in your code and only access it at one location. Soo…