- Home /
Question by
gian_unity190 · Feb 05, 2020 at 02:16 PM ·
listvar
specific object in list
the foreach (var obj in clones) does something to every obj in a list. is there a way to do this for only object number 6 or something. like an object in a specific index of the list?
Comment
Best Answer
Answer by ShadyProductions · Feb 05, 2020 at 02:20 PM
This is not unity related but basic C#
Any list or array have indexers that are accessed like:
Index 6:
var obj = clones[5]; // (0 based)
More info on arrays:
Your answer
![](https://koobas.hobune.stream/wayback/20220612222801im_/https://answers.unity.com/themes/thub/images/avi.jpg)