I am working on an inventory system, and for some reason this code only prints the first name of the object in the list.
if(gameObject.GetComponent<PlayerControl>().dead == true)
{
foreach(GameObject weapon in weapons)
{
print(weapon);
weapon.gameObject.GetComponent<GunScript>().beingHeld = false;
}
}
Can anyone explain this?