I am trying to write a function to get all enemies with tag “Enemy” within range lockOnDistance, and return the list of them. I don’t know how many enemies there will be in range, but I want to check the number of them so I can check the boolean version of this (i.e. “Are there enemies in range?” (is the size == 0)), so I have to use an arraylist instead of an array unless I want to go through every enemy and get the number in range (i,e, the size of the array), then go BACK THROUGH THEM ALL AGAIN and add them to the array, and surely there’s a better way than that
Issues:
-
Why won’t it let me say ArrayList?
-
It doesn’t recognize ArrayList.add(E)???