Question by
BenDurch · Jan 30, 2016 at 08:02 PM ·
gameobjectlayersfindlayermask
How do i find all objects in multiple layers? C#
I am trying to make an enemy that finds all objects within a specified layermask and then chase down the closest from that array. i know how to get the closest object from a list a few different ways, but i have no clue how to find all objects that have the specified layers. for example, i want the enemy to consider all objects that have the layer of animal or player to be it's target. is there a way to find these objects in a way similar to Objects = FindObjectsOfType ();
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612062350im_/https://answers.unity.com/themes/thub/images/avi.jpg)