Is there anyway to access the 'element number' of an object in a variable?

5663815--589735--upload_2020-4-3_0-36-42.png

Meaning this
Task Set Complete is a list of booleans that are ticked off when something enters a variable amount of collisions.
Should I do this using ‘foreach’ for each collision, and increase the value each time?
I’m unsure - I would kind of like to tag each object with their respective ‘element number’ (even though these aren’t really accessible).

If you have an array you can use the .IndexOf() method to ask where a particular entry exists.

Keep in mind it could exist at more than one place in the array. IndexOf returns the first occurrence:

1 Like

And List can do the same thing.

https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.indexof?view=netframework-4.8

2 Likes

Thanks all, I’ll try the index method, I think array does the job for what I need currently!