In short, I have collisions with triggers and want to call code depending on what type of collider is involved. I need to select the type of the collider, and then cast that…
if (cols[0].GetType() == typeof(PolygonCollider2D)) {
PolygonCollider2D polycolly = cols[0] as PolygonCollider2D;
PolyIntersect(polycolly);
}
Is this code the proper way? Or is there a better casting method?