Adding Ammo Pickups In Zombie Runner

How’d you go with adding ammo pickups?

Hi Rick,

I’m loving the course so far. Not too fast paced and also not too slow.

Quick question, though, regarding the part where you find the Ammo component from the Player. Is it faster (and safer) to simply do other.GetComponent<Ammo>().IncreaseCurrentAmmo(ammoType, ammoAmount) than using FindObjectOfType<Ammo>()? Is there any advantage in using FindObjectOfType?

Good question and one which I don’t think there is really a definitive answer. The rule that we always follow is “dont put a FindObjectOfType” in update if you can avoid it because there is some overhead to it. GetComponent is similar but in theory not quite as heavy. For the way that we are using it I think either of the 2 works fine.

2 Likes

All weapons ready! Still not sure if I want to use zombies or maybe something like Evil Robots of Doom.

Oh, I also found out that sniper rifle ammo is called NATO.