I'd be inclined to do this with a static variable on a script attached to your pickups:

 public class CountedPickup : MonoBehaviour {
 
 static int _pickupsRemaining;
 public static int PickupsRemaining { get { return _pickupsRemaining; } }
 
 void OnEnable() {
 _pickupsRemaining++;
 }
 
 void OnDisable() {
 _pickupsRemaining--;
 }
 }

Now your player script (or any other) can check `CountedPickup.PickupsRemaining == 0` to check how many are left to collect.

This will work even if this component doesn't know anything about what *kind* of pickup it is (it just represents the idea that this pickup should be included in the count, even if you mix & match different types of pickups in one level), and whether you `Instantiate()` & `Destroy()` pickups, or just toggle them on and off with `gameObject.SetActive()`