Adding Limited Ammo To Your Game

Adam Reed
Apr 23, 2021

When making a game, you may want to limit the number of times a player can shoot a gun, use an item, or perform an action. This is just an integer value that is checked before each use and updated after.

The code/logic below can be added to a player script along with your regular shooting code to add an ammo count.

In my next article, we will be going over the creation of an ammo refill powerup!

--

--

Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!