UI — Improved Ammo Display

Objective: Add the maximum ammo to the UI and cap the ammo collected

In this article, we will make a slight improvement where we will let the player know the maximum ammo the ship can carry.

UI Improvement

In the AmmoUI, create new textboxes (or duplicated the AmmoText which I had renamed to CurrentAmmo) and position them. For this first phase, I simply hardcoded a 50 as the text for the Max Amount UI Textbox. Maybe at a later stage, we will introduce changes in the maximum amount and update the UI.

Implement the code

In the PlayerShoot script, add a variable to store the maximum ammo amount.

The following change to the UpdateAmmo method to cap the ammo to the maximum amount.

If you enjoyed reading this article give me a Clap, also if you would like to see more, “Follow” me, so you may be notified of future releases. You may also send me a message if you need any further help.

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Install and Configure Redis on Ubuntu 18.04.2 LTS

รูปแบบ CayenneLPP

A practical guide to Rasa chatbot — Part 02 (Building Covid19 Chatbot)

How to add new application to XFCE menu list

4 Things to Consider Before Choosing a High-Quality Software House

software house

How and why should you hide Promoted Jobs in Linkedin?

Laravel & JWT authentication & Creating custom authentication contracts

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jean-Noel Seneque

Jean-Noel Seneque

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com

More from Medium

How to Make the Camera Shake Using Impulse Listener Extensions in Cinemachines Virtual Cameras

Racing Car Game # Day 4— Braking & Skidding

Level Design in Unity 3D Part 2: The Walls

Unity highlight text instead of button