Drawing Circle with Physics2D.OverlapCircleAll,Make Physics2D.OverlapCircleAll a GUI

Hello Everyone,

I have a game with a bomb that creates a circle around the bomb once it hits an enemy. Everyone inside of that circle that is an enemy gets destroyed. However, I also want to see the circle in the game so I can readjust it to meet the radius that’s appropriate for it, but I can’t figure out how to do that. The code so far can be seen below:

 using UnityEngine;

 public class Explosion : MonoBehaviour
 {
[SerializeField]
private float Range = 0.65f;

private GameObject Enemy;
private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.collider.tag == "Enemy") {
        Collider2D[] ColliderArray = Physics2D.OverlapCircleAll(transform.position, Range);

        foreach (Collider2D collided in ColliderArray) {
            if (collided.tag == "Enemy") {
                Destroy(collided.gameObject);
            }
        }
    }
}
}

If you want to see it in the game why not just use a sphere? if you want to see it in the editor you could use Gizmos.DrawSphere.


Edit: Just noticed you are making a 2D game so you could similarly just use a sprite for in game testing.


You know the size it needs to be because you are setting it with Range