Skip to Content
Augmented Reality for Developers
book

Augmented Reality for Developers

by Jonathan Linowes, Krystian Babilinski
October 2017
Intermediate to advanced
548 pages
13h 23m
English
Packt Publishing
Content preview from Augmented Reality for Developers

Handling empty scenes

If you delete all the pictures from the scene, we'll respawn a new one, so there's always at least one present. One way to detect the presence of pictures is to use tags. Let's add a Picture tag to our project and assign it to the DefaultPicture. Then we can see when all pictures are deleted, and we will know when to respawn one:

  1. In Unity, with DefaultPicture selected, click the Tag list and choose Add Tag.
  2. Press the + to add a new tag and name it Picture.

 

  1. Now, back in the DefaultPicture's Inspector, use the Tag list again and select Picture,
  2. Press Apply to save the prefab,

Now we can add the following code to GameController:

File: GameController.cs private int delay = 1; void Update() { if (delay == 0 && GameObject.FindGameObjectsWithTag("Picture").Length ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Augmented Reality Game Development

Augmented Reality Game Development

Micheal Lanham
Augmented Reality

Augmented Reality

Joseph Rampolla, Greg Kipper

Publisher Resources

ISBN: 9781787286436Supplemental Content