Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity Certified Programmer: Exam Guide

You're reading from   Unity Certified Programmer: Exam Guide Expert tips and techniques to pass the Unity certification exam at the first attempt

Arrow left icon
Product type Paperback
Published in Jun 2020
Publisher Packt
ISBN-13 9781838828424
Length 762 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Philip Walker Philip Walker
Author Profile Icon Philip Walker
Philip Walker
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Setting Up and Structuring Our Project 2. Adding and Manipulating Objects FREE CHAPTER 3. Managing Scripts and Taking a Mock Test 4. Applying Art, Animation, and Particles 5. Creating a Shop Scene for Our Game 6. Purchasing In-Game Items and Advertisements 7. Creating a Game Loop and Mock Test 8. Adding Custom Fonts and UI 9. Creating a 2D Shop Interface and In-Game HUD 10. Pausing the Game, Altering Sound, and a Mock Test 11. Storing Data and Audio Mixer 12. NavMesh, Timeline, and a Mock Test 13. Effects, Testing, Performance, and Alt Controls 14. Full Unity Programmer Mock Exam 15. Other Books You May Enjoy Appendix

Animating our three-dimensional enemies

Here's a really easy, quick animation with the script for your enemies. Currently, the enemies just move up and down in a wave pattern. However, the units themselves remain static.

Let's give our enemies a bit of extra life with some code:

  1. In the Project window, go to Assets/Resources/Prefab/Enemies.
  2. Expand the content of the enemy_wave prefab and select the enemy_wave_ring child game object.
  3. In the Inspector window, click on the Add Component button.
  1. Click on New Script at the bottom of the dropdown.
  2. Name the new C# script BasicEnemyRotate.
  3. Then, enter this code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BasicEnemyRotate : MonoBehaviour
{
[SerializeField]
float speed = 0;

void Update ()
{
transform.Rotate(Vector3.left*Time.deltaTime*speed)
}
}
...
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