|
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.
(comments are locked)
|
|
I would just use a foreach as you are using a List. Yeah that is what I thought would be the answer I will wait to see if anyone can address whether or not there is an alternative if not ill accept that this is the best way. I was just wondering how expensive it is to call this every frame as thats what I would need to do.
Aug 09 '11 at 03:47 PM
sacredgeometry
(comments are locked)
|
