How to count objects inside cube?

how to count objects with some tag and which are only inside cube with specific tag? Is there any script ?

Thanks in advance

Depends if you want objects that are fully inside or if you accept those which intersect.

Anyway, you can start by using OverlapSphere and then narrow it down by checking if each collider’s bounds are contained / intersecting with the box in question.

Another way would be to use a trigger. Enable it at the position / size you want to examine. In OnTriggerEnter, store all the colliders you receive, wait for fixed update and one frame further (to be sure something is happening) and disable it.