public void onDie() { int amount = Random.Range(minItems, maxItems); for (int i = 0; i < amount; i++) { ItemPickup pickup = Instantiate(pickupPrefab.gameObject, transform.position, Quaternion.identity).GetComponent <ItemPickup>(); pickup.setItem(lootTable[Random.Range(0, lootTable.Count - 1)]); pickup.GetComponent <Rigidbody>().AddForce(Random.insideUnitSphere * 100f, ForceMode.Impulse); } }