Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Augmented Reality for Developers

You're reading from   Augmented Reality for Developers Build practical augmented reality applications with Unity, ARCore, ARKit, and Vuforia

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787286436
Length 548 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jonathan Linowes Jonathan Linowes
Author Profile Icon Jonathan Linowes
Jonathan Linowes
Krystian Babilinski Krystian Babilinski
Author Profile Icon Krystian Babilinski
Krystian Babilinski
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Augment Your World FREE CHAPTER 2. Setting Up Your System 3. Building Your App 4. Augmented Business Cards 5. AR Solar System 6. How to Change a Flat Tire 7. Augmenting the Instruction Manual 8. Room Decoration with AR 9. Poke the Ball Game

Keeping score


When you score a goal, it should add to your score. If you miss, points are deducted from your score. Scores are displayed in the UI. We will also keep track of your all-time high score, using persistent storage. First, we'll create a UI for the score board.

Current core UI

The score board will be a canvas child of ThrowingGame:

  1. With ThrowingGame selected in the Hierarchy, create a new UI | Canvas, named GameCanvas.
  2. Set its Render Mode to World Space.
  3. For its Rect Transform, set Scale to (0.015, 0.015, 0.015).
  4. And Anchors: Min (0,5, 0.5), Max (0.5, 0.5) and Pivot (0.5, 0.5).
  5. Then Position (-1, 2.5, 1), Width/Height: (100, 100).
  6. Set the Canvas Scaler Dynamic Pixels Per Unit to 4, to give the text some higher resolution.

The Canvas gets a child Panel, which in turn gets child Text elements:

  1. Add a child of GameCanvas, create a UI |Panel, named ScorePanel.
  2. Set its Rect Transform Left: -40, and Right: 40.
  3. If you've installed the BallGame assets pack, set its Source Image to Circle (doughnut...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image