- Home /
Any idea on how to make objects be clicked in a certain order? (C#)
I have a list of clickable objects, where the index of the list also corresponds to the order in which the objects need to be clicked. The list gets emptied and refilled with a random amount of new objects every level (up to around 16) so I cant do it with cases (at least I dont think). Is there some way to deal with this?
Thanks in advance
Answer by KISP · Feb 08, 2019 at 02:34 PM
If you already have a list of the gameobjects in the order that they need to be clicked, couldn't you compare that object in the list against the one that's been clicked? Something like this:
int clickedIndex = 0;
// Wait for click
// Get clicked object
if (clickedObject == clickedObjectList[clickedIndex])
{
// do stuff
clickedIndex++;
}
This slipped my $$anonymous$$d! Doesn't work 100% on first implementation but I suspect its because something is going slightly wrong before this stage. Thanks!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Null reference at for loop (list) 0 Answers