Hi, how do I make my script spawn multiple target images at multiple objects?
For now the script only targets 1 object at a time, how do I make it so that it targets multiple objects at a time.
private bool RADSYSB()
{
RaycastHit hit;
Vector3 sy = ship.transform.position;
if (Physics.SphereCast(sy, range, ship.transform.forward, out hit, 400))
{
target = hit.transform;
distanceF = hit.distance;
return true;
}
Debug.DrawRay(ship.transform.position, sy, Color.green);
return false;
}
private void UpdateCrosshair()
{
if (crosshair)
{
if (target)
{
if (crosshair.gameObject.activeSelf)
{
crosshair.position = ship_camera.WorldToScreenPoint(target.position);
}
}
}
}
Any help is highly appreciated, thanks in advance