Answers for "Display the elements in an array one at a time using getkeydown in unity"

C#
0

Display the elements in an array one at a time using getkeydown in unity

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;
}
}
Posted by: Guest on April-20-2022

Code answers related to "Display the elements in an array one at a time using getkeydown in unity"

C# Answers by Framework

Browse Popular Code Answers by Language