Hi! I was wondering if it is possible to change the text of four buttons depending upon the picture shown. I am trying to create a guessing game that displays a random screenshot of a game and has four different options. Currently I have made a script for a random image to appear on screen. The pictures are stored in an array. So my question is, is it possible to make a script to change the text of the buttons dependent on the position in the array and if so how would I go about it. I have been stumped on this for a while. Thanks in advance!
Example: A picture of Rocket League appears and there are four buttons one with the correct answer and three with the incorrect answer.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// This is my code for generating a random picture
public class LoadRandomPicV2 : MonoBehaviour {
public Texture2D pic0;
public Texture2D pic1;
public Texture2D pic2;
public int pick;
Texture2D[] pics;
// Use this for initialization
void Start() {
pick = Random.Range(0, 3);
pics = new Texture2D[3];
pics[0] = pic0;
pics[1] = pic1;
pics[2] = pic2;
}
private void OnGUI()
{
GUI.DrawTexture(new Rect(0, 3, 334, 212), pics[pick]);
}
}