public void TakeItem() { //search the backweapon list and enable it GameObject newWeapon = controller.AttackScript.secondWeaponParent.Find(showItem.GetComponent <ItemProperties>().itemName).gameObject; newWeapon.SetActive(true); if (controller.AttackScript.secondWeapon != null) { //drop item controller.AttackScript.secondWeapon.gameObject.SetActive(false); ItemProperties newProperties = controller.AttackScript.secondWeapon.GetComponent <ItemProperties>(); if (newProperties != null) { ItemProperties properties = showItem.GetComponent <ItemProperties>(); // apply new properties to the item properties.itemName = newProperties.itemName; properties.visualMesh = newProperties.visualMesh; properties.textColor = newProperties.textColor; properties.visualScale = newProperties.visualScale; properties.turnRate = newProperties.turnRate; properties.YAxis = newProperties.YAxis; properties.initiateRotate = newProperties.initiateRotate; // apply physically properties.ResetItem(); // apply to the UI PickingItem(showItem); // reset tranform showItem.transform.position = new Vector3(transform.position.x, controller.AttackScript.secondWeaponParent.transform.position.y + 0.5f, transform.position.z); // toss it to a random direction with constant force apply Vector3 torque; torque.x = (Random.Range(0, 2) * 2 - 1) * tossItemForce; torque.y = Random.Range(4, 5); torque.z = (Random.Range(0, 2) * 2 - 1) * tossItemForce; showItem.GetComponent <Rigidbody>().AddForce(torque, ForceMode.Impulse); } } else { Destroy(showItem); } controller.AttackScript.secondWeapon = newWeapon.transform; }