Mobile Game Progression

Adding UI feedback to the store

Throughout the process of making the shop in the game, there was never a feature which allowed the player to get notified whenever they had brought the item from the store. Therefore for this article we will cover how to implement a popup feature which tells the player what object they have purchased.

Preparing the popup:

Within Adobe illustrator I drew several banners with different text, each banner indicating a different feedback to the player.

As usual, I would save as a PNG file and import the file into Unity which I would then slice the image accordingly.

In the Unity hierarchy I created a new empty game object within the Canvas that is going to contain all of the pop up alerts. I drag each individual image as a child image object.

properly named objects… kinda

As an added bonus I decided to animate the individual alert popups so they appear to fade in and out instead of just showing up.

Animating the fade in and out

Scripting the popup Alert toggle:

In our MerchantNPC script which hands all interaction for the store, we are going to establish the handles for every pop up alert as game objects.

In the Buy item method within each switch array I would make the Set Active ability to “true”. This would turn on the game object causing the animation (fade and out) to start playing automatically. Unfortunately we don’t want the animation to repeat itself every time we open up the shop.

Therefore we will set up an IEnumerator which will control a timer. After the set amount of seconds we will turn off every single alert popups.

we can make the wait time to be just the same duration as the entire animation clip

Now every time we trigger the store bought item, the popup would show and disappear, perfect for giving the players proper feedback.

--

--

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