text: Q:
  
  Display the Elements in an Array One at a Time using GetKeyDown in Unity
  
  I'm essentially trying to make a slideshow in Unity 2018. I want to display a new image every time, say, the right arrow key is pressed. I could do this by loading a whole new scene every time the right arrow key is pressed, but I could have potentially thousands of scenes (it's a pretty long slideshow!), and I wondered if there wasn't a more elegant solution. I thought the best way to accomplish this would be with an array of images and a simple for loop to move to the next index in the array. 
  So I created a few image GameObjects and a script that puts them into an array. The problem I have is that whenever I press the right arrow key, the for loop I've implemented shoots right the way through to the end of the array and thus I only see the last image. I want to be able to go through each image one by one as I press the right arrow key.
  My code: 
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class LoadImage : MonoBehaviour {
  
  [SerializeField] private Image newImage;
  [SerializeField] Image[] nextImage;
  
  // Use this for initialization
  void Start () {
  
  }
  
  // Update is called once per frame
  void Update () {
      GetNextImage();
  } 
  
  private Image GetNextImage()
  {
      if (Input.GetKeyDown(KeyCode.RightArrow))
      {
          for (int i = 0; i < nextImage.Length; i++)
          {
              newImage = nextImage[i];
              newImage.enabled = true;
          }
      }
      return newImage;
  }
  } 
  
  Here are a few images of my Unity work space while the game is stopped and while it's running: 
  The game is stopped,
  The game is running but I haven't pressed the right arrow key,
  The game is running and I've pressed the right arrow key. 
  As you can see in the last image instead of moving to element_1 and staying there until I press the right arrow again, it iterates all the way through until element_2. 
  As I'm sure you can tell, I'm a novice, and any help at all would be greatly appreciated. 
  Thank you.
  
  A:
  
  At the moment your for loop always start with 0 because i = 0 and ends at the end of your image array.
  But you don t need the loop.
  You have to remember the number of your current image. This example shows how it works in one direction.
      int currentImageIndex = 0;
      private Image GetNextImage()
      {
          if (Input.GetKeyDown(KeyCode.RightArrow) && currentImageIndex < nextImage.Length)
          {
              //Take image on current postion
              newImage = nextImage[currentImageIndex]; 
              newImage.enabled = true;
              //Add one to currentImageIndex 
              currentImageIndex++;
          }
      }
  
  