Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Cycle()
- {
- //Increment index
- Index++;
- if (Index == list.Count)
- {
- Index = 0;
- }
- //Perform the cycling.
- //For each in the list of objects...
- for(int i = 0; i < list.Count; i++)
- {
- //Check if they're active
- if (list[i].active)
- {
- //If it isn't the object you seek disable it.
- if (i != Index)
- {
- list[i].SetActive(false);
- }
- }
- else //If it's inactive...
- {
- //If it's the object you seek, enable it.
- if (i == Index)
- {
- list[i].SetActive(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement