for(int i=0;i<colliders.Length;i++){
if (colliders *.gameObject.GetComponent<Foo>() != null) {*
colliders .gameObject.GetComponent().Bar = true } So I set bool Bar value to true if the gameobject is in Physicss2d circle. When the gameobject leaves the circle I need to set Bar variable to false. Is there a way to achieve this without creating dynamic List of gameobjects?
To save yourself constantly regenerating a List<>, I would use OnTriggerEnter2D and OnTriggerExit2D along with a CircleCollider2D trigger to add and remove objects from the list, respectively.