Unity Tutorial 04
Image from the tutorial For this weeks Unity tutorial I had to continue on from last weeks lesson where we created the game in which you fire food at animals. This time we learned how to make an animal spawn automatically every couple of seconds instead of them spawning when a key is pressed. I also learned how to make the food and animal disappear from the scene when the food hits the animal. For the first time I had to create a new method called SpawnRandomAnimal () {. The type of method is called a void. I then had to copy and paste my code from my If-statement and paste it into my new void and remove the code from my if-statement. Then I had to add SpawnRandomAnimal (); to my If-statement. To make my animals spawn on a timer instead of spawning when a key is pressed I had to add InvokeRepeating("SpawnRandomAnimal", startDelay, spawnInterval); into my start method. I then had to remove my If-statement so that I no longer had to press S to spawn animals. I then had to two...