Hi I am trying to figure out the best way to find all instantiated bombs (GameObjects) so far the way I have theorised (please tell me if there is a more efficient method of doing this) is to add all the bombs to a static array/List on instantiation called bombList.
When the bomb has exploded I will remove it from the list. The problem comes now when I want to access all the bombs at once, I found the foreach method and I was wondering if there was a way of using it to say access all the bombs names?
I realise that i could make a function which uses a for loop to iterate through the list and return the names but I was just wondering (for the sake of expedience and knowing) if there is a more efficient/ implemented way of doing this. As it stands I probably have to do this sort of process for a lot of things so any advice on better ways of dealing with this is also appreciated.
I would just use a foreach as you are using a List.
answered Aug 09 '11 at 03:44 PM