October 2017
Intermediate to advanced
548 pages
13h 23m
English
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:
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 ...