private void OnTriggerEnter(Collider collision) { if (zapped == true && collision.transform.tag == "Enemy" && collision.transform.GetComponent <Enemy>().zapped == false) { collision.transform.GetComponent <Enemy>().trap = trap; Trap _trap = trap.GetComponent <Trap>(); if (_trap.count != _trap.maxvalue) { _trap.AddLine(collision.gameObject); _trap.testsubjects[_trap.count] = collision.gameObject; print(_trap.count); collision.transform.GetComponent <Enemy>().numba = _trap.count; collision.transform.GetComponent <Enemy>().zapped = true; collision.transform.GetComponent <Enemy>().previous = gameObject; } } }