Hii!
So I have a problem with my script where the Gizmo is a bit larger than the OverlapBox
. I have dealt the size of the gizmo because I read in another post that the OverlapBox
deals in halfs or something. Neither works.
Please lend me aid in this, its driving me mad!
public class CheckRooms : MonoBehaviour
{
public float enemyCount;
public Vector2 checkRange;
private void Update()
{
CheckRoom();
}
void CheckRoom()
{
enemyCount = 0;
Collider2D[] countEnemies = Physics2D.OverlapBoxAll(gameObject.transform.position, checkRange, LayerMask.GetMask("EnemyLayer"));
foreach (Collider2D enemy in countEnemies)
{
Debug.Log(enemy.gameObject.name);
}
}
void OnDrawGizmosSelected()
{
Gizmos.color = Color.blue;
Gizmos.DrawCube(gameObject.transform.position, checkRange / 2);
}
}