But now I want to show the position of the selected enemy on the screen when it's off camera. So my questions are:
How do I know when an enemy is off camera.
How can I show in GUI an arrow on the edge of the screen that points to the position of that enemy. Perhaps something related to what I did to point towards the crosshair?
Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range); Vector3 targetDir = positionOnScreen - transform.position;