O'Reilly logo

Unity 5.x Game Development Blueprints by John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Purchasing upgrades

Now that we have the shop menu up and working, let's add in the functionality to purchase things:

  1. Go to the Hierarchy tab and then toggle the ShopMenu back on and delete all of the other buttons except for one which will be our reference for others.

    We will want each button to have three texts—the name of the object, the number we have, and the cost to build another.

  2. First, change this object's name to Desc and change the Text component's Alignment to the left horizontally, then duplicate it (Ctrl+D) name the duplicate Cost and center it. Finally, duplicate once more and change the name to Qty and put it on the right. Fill in the values if you'd like, but we'll be replacing the contents via code shortly:
  3. Select the Button object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required