void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (itemNum == 1) { playerInfo.AddHP(1); } else if (itemNum == 2) { playerInfo.AddPW(); } Instantiate(text, textSpawn.position, textSpawn.rotation); Destroy(gameObject); } }