Hi, I’m having an issue where an error comes up saying “Cannot implicitly convert type ‘UnityEngine.Collider2D’ to ‘UnityEngine.Collider2D’”. I’m not sure how to resolve this, but after some reading I’m sure it has something to do with Lists, which is something I’m not familiar with yet (still learning programming).
The effect I’m attempting to create is a blowback effect (like an explosion pushing back entities around it), but only the Y-axis is affected. Haven’t been able to test if the effect works yet, due to this error. Thank you for anyone who’s able to provide advice.
void BlowbackArea(Vector2 location, float blowbackRadius, float hpmMagnitude)
{
Collider2D[] objectsInRange = Physics2D.OverlapCircle(transform.position, 6.5f, whatIsHexPlate);
foreach (Collider2D col in objectsInRange)
{
HexPlate hexPlate = col.GetComponent<HexPlate>();
if (hexPlate != null)
{
float proximity = (transform.position.y - hexPlate.transform.position.y);
float effect = 1 - (proximity / blowbackRadius);
}
}
}