SphereCastAll not working

foreach(RaycastHit dectected in dectectedobjects){

i am trying to use SphereCastAll to detect every objects which in in front of the player character.
while it do not return anythings.
For the objects which have to be detected, i have add the box collider and click the isTrigger.
What i have miss?

p.s. i want to upload an image show what i have done, but when i upload the image from my computer, the preview and resize overlap the accept button and i cannot click the accept.
the preview seem also cannot be relocated, then how can i upload the image?

Imagine the initial sphere at transform.position specified in your SphereCastAll(). The front edge of that sphere must be before the objects you will detect during the cast. If the sphere intersects the object at the start or if the object is inside the sphere, it will not be detected. I don’t know your game mechanic, but one solution is to back off the position of the sphere before casting:

dectectedobjects=Physics.SphereCastAll(transform.position-transform.forward * 30f,30f,transform.forward,1000f);

This will place the front edge of your sphere at transform.position, so any objects in front of the pivot point are potential candidates. Depending on your game layout, this may find things you don’t expect. You may want to move the cast position forward a bit so that is is at the front edge of your character rather than at the pivot point.

Quote from spherecast(all) docs: “Note: The sphere cast does not work against colliders configured as triggers.”

You write (thanks for being thorough): “i have add the box collider and click the isTrigger.”

I don’t know why this is a rule, when raycasts hit triggers just fine, and in practice the two are interchangeble. I’ve spent minutes and minutes, after switching a raycast against a trigger to a thin spherecast, re-remembering this fact.

If all you will ever do is raycast on it, could put the collider on a layer set not to interact with anything.