Member-only story
Unity2D DevLog 04 — UI Ammo Counter

Last time, I shared an article on how I improved my shield powerup. It’s now time to work on an ammo counter. Infinite firepower is a feature of some games, but I want to include some limitations.
Objective:
Create a replenishable ammunition system for the player. Include a way to display ammo information on the UI.
How I went about it:
I had already planned for this feature in my UI.
The space UI element for the ammo counter is ready. All I need now are some graphic elements for the numbers.
Rather than using pre-made fonts, I chose to create graphics for the numbers. I had to make sure the numbers matched the style of the background art.
After importing and slicing the Sprite Sheet, I used individual Image Elements to place each number in the UI.
The Post Processing effects already help to make the numbers look illuminated.
Now comes the fun part. I created a new Script to handle my AmmoCounter. The first thing I added was two Sprite Type Arrays to hold my numbered sprites. The neat thing about this is that each sprite’s index corresponds with the number in the image.