get array of RaycastAll hits

Hey! I wanna get a list of all hits that my RaycastAll gets. so far i tried this:

public GameObject[] rayhits;

 RaycastHit closestValidHit = new RaycastHit();
    
    			RaycastHit[] hits = Physics.RaycastAll(transform.position, transform.forward, 100.0F, layers);
    
    			for (int i = 0;i < hits.Length;i++) {
    				GameObject rayhits = hits *.collider.gameObject;*
  •  	}*
    

but that doesent give me any result somehow?

do you have rigidbody on the objects you want to raycast against. even if they are set to kinematic