void DrawCollider(CubeDrawer drawer, BoxCollider collider, Transform targetTran) { if (!collider) { return; } Gizmos.matrix = Matrix4x4.TRS(targetTran.position, targetTran.rotation, targetTran.lossyScale); drawer(collider.center, collider.size); Gizmos.matrix = Matrix4x4.identity; }
void DrawCollider(CubeDrawer drawer, BoxCollider2D collider, Transform targetTran) { if (!collider) { return; } Vector3 newColliderLocation = new Vector3(targetTran.position.x + collider.offset.x, targetTran.position.y + collider.offset.y, targetTran.position.z); Vector3 newColliderSize = new Vector3(collider.bounds.size.x, collider.bounds.size.y, collider2D_ZDepth); drawer(newColliderLocation, newColliderSize); }