Answer the question
In order to leave comments, you need to log in
How to put everything in the Physics2D.OverlapCircleAll into an array of the GameObject type?
Can you please tell me whether it is possible to assign an array to the GameObject type, everything that is included in the Physics2D.OverlapCircleAll colo.
Like this, but not Collider2D[] but GameObject[]:
Collider2D[] hh = Physics2D.OverlapCircleAll(transform.position, 12f);
Answer the question
In order to leave comments, you need to log in
If I understand you correctly (fortunately I know Ukrainian), then you want to get GameObject[] from Collider[] .
You can use LINQ for this, however I don't recommend using this in Hot code
using System.Linq;
----------
GameObject[] hh = Physics2D.OverlapCircleAll(transform.position, 12f).Select(a => a.GetComponent<GameObject>());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question