void CheckIfHitsTarget() { //Use a raycast shooting forward to see if we clicked on a target RaycastHit2D hit = Physics2D.Raycast(cursor.Position, Vector3.forward, 100f, enemyLayer); //Debug.DrawRay(cursor.Position, Vector3.forward * 100f, Color.red, 10f); if (hit.collider != null) { cursor.FlashHitCross(); GameplaySceneManager.instance.IncreaseKillCount(); Object.Destroy(hit.collider.gameObject); } }