How can I detect/count number of objects spawned in a room?

I would make a new trigger box class and when I need to check how many items are in the volume I would check the overlapping actors.

TArray<AActor* > ItemsInArea;
    
BoxComponent->GetOverlappingActors(ItemsInArea);

return ItemsInArea.Num();

Then check the size of the array. You might want to replace AActor* with your item base class. If the objects don’t despawn and not pickup-able, you could count the objects as they spawn.