void OnTriggerExit(Collider coll) { var test = coll.gameObject.GetComponent <GrabbableScript>(); if (test != null) { Debug.Log("grabbableObject leaving"); if (GrabbablesAvailable.Any(c => c.GetInstanceID() == test.GetInstanceID())) { GrabbablesAvailable.Remove(test); } } }
private void OnTriggerEnter(Collider coll) { var test = coll.gameObject.GetComponent <GrabbableScript>(); if (test != null) { Debug.Log("Detected grabbableObject"); if (!GrabbablesAvailable.Any(c => c.GetInstanceID() == test.GetInstanceID())) { GrabbablesAvailable.Add(test); } } }