using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShootingRange : MonoBehaviour { public float range = 5f; public LayerMask playerLayer; public bool inRange = false; public GameObject target; void Update() { } private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { inRange = true; target = collision.GetComponent(); } else inRange = false; } }