using System.Collections; using System.Collections.Generic; using UnityEngine; public class ProductReceiver : MonoBehaviour { ///HashSet enteredBodies = new HashSet(); public int normalProductCount; public int defectiveProductCount; private void OnTriggerEnter(Collider otherCollider) { var product = otherCollider.GetComponentInParent(); if (product != null) { if (product.Defect != DefectType.None) { defectiveProductCount++; } else { normalProductCount++; } Destroy(product.gameObject); } } }