[SOLVED] Object detection inside a GUI area

Hi guys,
today i’m here with a new problem for you!!! YEAH !!!
Basically what i’m trying to do is to detect if an object is inside a GUI area…well…a circle crosshair. Image to explain:

So when an enemy is inside of this crosshair a target-lock texture shows up and follows the enemy (this part of the script is already done, so you can skip it)

I hope in someone that can help me out and thanks in advance
Bye :wink:

One way of doing it:

  1. Use WorldToScreenPoint using the objects position to get the point on screen.
  2. Calculate distance from crosshair center to point on screen.
  3. If this distance is less than your crosshair radius, then its inside.