Home > Net >  How to find an object in a certain radius with a certain tag near a certain point
How to find an object in a certain radius with a certain tag near a certain point

Time:12-09

I need to find an object with the tag "block" in a certain radius from the point. How can this be done?

I tried to look for an object whose coordinates are less than the coordinates of the point to which the radius is added, but it didn't work and the engine just froze dead.

CodePudding user response:

OverlapSphere can help you with that. It gives you a list of colliders that were hit by the defined sphere, you can loop over them and compare the tags.

Overlapsphere could also be restricted to work on specific layers (using the layermask), which may help you as well.

  • Related