Quantcast
Channel: Questions in topic: "gui"
Viewing all articles
Browse latest Browse all 125

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

$
0
0
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); } } } } }

Viewing all articles
Browse latest Browse all 125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>