Mobile Game Progression
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.
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.
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.
Now every time we trigger the store bought item, the popup would show and disappear, perfect for giving the players proper feedback.