void OnTriggerEnter(Collider col) { if (col.gameObject.name != target || privateAPI == null) { return; } Transform parent = col.transform.parent; if (parent == null) { return; } string carName = parent.name; if (privateAPI == null) { return; } privateAPI.CollisionWithCone(carName, index, Time.fixedTime); Timer[] status = parent.gameObject.GetComponentsInChildren <Timer>(); foreach (Timer t in status) { Debug.Log("Collision with penalty cone"); t.OnCollideCone(penalty); } }