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

Adding in a time limit

Of course, if we kept playing the game, it would get boring over time due to their being no stakes, so let's add in a time limit to have the player hit as many ducks as possible within that time!

  1. Let's add in a text to display to the player how much time they have left. To do this, go to Game Object | UI | Text and then switch over to the Game tab to see it.
  2. Select the Text object from the Hierarchy and then from the Inspector tab, rename it to Time Text. Afterwards, open up the Anchor Presets menu on the left-hand side of the Rect Transform component, then hold Alt+Shift and then click on the top-center option to reposition the object.
  3. Then, change Height to 100 and Width to 400, so when we increase the size, it'll still show ...

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