- Home /
Hi, I making the quiz for my research. How can change the quiz image by question ID or submit Button?
Hi Im Japanese student I making the quiz and there is a image for each question. I want to change the this image when push the submit button or when the question ID have changed. But I cant slove this problem.
I have just start use unity and Im biginner, I need finish this work by next month and I need write Graduation thesis quickly.
this link is my Demo Asset, maybe it can help you to find problem. https://ufile.io/mowpm
thank youlink text
Answer by Akadeax · Oct 16, 2018 at 09:19 PM
Hey! If I understood everything, you just want to change an image? Use UI (tutorial in case u need it ^^) for that (Only Pseudo-code, might not work in unity):
public Image reference;
public List<sprite> QuizImages = new List<sprite>();
void Update()
{
//You could also make some function for a UI button
if(PressedSubmit)
{
//Change the UI Image to the image at the given index
reference.image = QuizImages[whatever Image index];
}
//In case you want randomization
if(PressedSubmitRandom)
{
reference.image = QuizImages[Random.Range(0, QuizImages.Count -1)];
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612180431im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Quiz Game: How to replace Text with Images? 2 Answers
Adding Images for Quiz Game 0 Answers
Stamping an image onto an object? 2 Answers
how to customize image that is used in default skin for GUI.Box? 1 Answer
BloomAndFlares Monodevelop compile error 0 Answers