getting the radius/position of overlapsphere

Hey guys,
noob question, but i applied an overlap sphere using add componenet. When writing my collision detection code, how do I get the radius and center I applied?

 Collider[] cols = Physics.OverlapSphere(center, radius);

I have this so far, but it doesnt recognize the “center” and “radius” from when I added the component.

It is a static method, there is no way to know which object called. So, center is defined as world coordinates.

Use something like:

Physics.OverlapSphere(transform.position + center, radius);

You’re probably confusing a Sphere Collider with OverlapSphere. A Collider component automatically checks for hitting stuff. And, when it does, it knows to run whatever code you put in OnCollisionEnter. It’s the more common.

OverlapSphere isn’t a component. It’s a 100% programmed way to “flash” a temp collision sphere. The center and radius are whatever math you feel like putting there. It’s mostly used for special 1-time detection. Like to see who’s hit by an explosion.