I need to check is there any object between 2 object.

Hi, im tring to write an AI for 2D game and i need to check is there any object between 2 Object. can u help me for this ?

Raycast, or Trigger box collider might be your best bet… I personally find a box collider easier to work with, but Raycasing more accurate - then check specific info so you dont detect things like walls or stuff, check the object names it finds, tags, layers, scripts/components, any specific ways you wan to identify objects you actually want to check, verse world objects you dont care about, like walls or the floor.

Thank you for answer @Dibbie you are right Raycast is a good way but for 1 point. http://puu.sh/lhThi/80e0efbddc.png i have a problem like this. In image player is inside of AI’s field of sight but if i use this raycast he cant see him how can i fix this ? have u any idea ?