Comments and answers for "Stuck with unity quiz game logic"
http://answers.unity.com/questions/1632112/stuck-with-unity-quiz-game-logic.html
The latest comments and answers for the question "Stuck with unity quiz game logic"Comment by dino231990 on dino231990's answer
http://answers.unity.com/comments/1632354/view.html
thanks for this answer , i will try it out and let you knowThu, 16 May 2019 13:42:53 GMTdino231990Answer by tormentoarmagedoom
http://answers.unity.com/answers/1632183/view.html
Hello dino.
If you pretend to find a random element in an array, you will need to use Random.Range()
And then, if pretend to no repeat one element, to recieve always a new one, you should have a "availability array". I mean, have a boolean array, so each question stores in this array when is used.
So you should have some logic like this:
bool [] QuationsUsed = new bool[number of questions]
int number = random.range
while ( QuationsUsed[number] = true)
{
number = random.range
}
At this point, numbner will be only a non-taken question/number. So now, lets use it.
You chose Questions[number] , and set its bool as true to prevent beeig selected again
QuationsUsed [number] = true;
Thats all you need!
Bye!Thu, 16 May 2019 08:05:12 GMTtormentoarmagedoom