Phase 1 — Ammo Count

The Player will now be given a limited ammo count of 15 to prevent laser spam.

Create another Text UI element under the Canvas and call it something like “Ammo_count_text”. Update the following in the UI Manager script.

UI Manager script

As the game starts the ammo is full, and as it’s being fired the text will be updated with the remainder.

In the Player script, it will have a int variable for the ammo. The Player can only fire it they have ammo, which decrements when fired, and updates the UI Manager.

Player script